0% found this document useful (0 votes)
15 views2 pages

Java Programming Exam - Linux Focus

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Java Programming Exam - Linux Focus

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

QP CODE: 22102063 Reg No : .....................

22102063
Name : .....................

[Link] DEGREE (CBCS) SPECIAL SUPPLEMENTARY EXAMINATIONS, MAY 2022


Fifth Semester
CORE COURSE - CS5CRT14 - JAVA PROGRAMMING USING LINUX
Common to [Link] Computer Applications Model III Triple Main, [Link] Computer Science Model III,
[Link] Information Technology Model III & Bachelor of Computer Application
2019 Admission Only
98A6FBC1

Time: 3 Hours Max. Marks : 80


Part A
Answer any ten questions.
Each question carries 2 marks.

1. List out the different branching statements used in Java.

2. Analyse the use of labelled loop.

3. Define classes and objects.

4. How will you access class members using objects?

5. What is static members?

6. What are the methods in String class?

7. What is multi threading?

8. Define an Event Listener.

9. What are the differences between JTextField and JTextArea?

10. Differentiate between Flow layout and Border layout.

11. Write structure of Java applet program.

12. What is JDBC ResultSet?


(10×2=20)
Part B
Answer any six questions.
Each question carries 5 marks.

Page 1/2 Turn Over


13. Is Java platform independent and robust languag? Justify your answer

14. Explain relational and logical operators in Java with examples.

15. Discuss final methods in detail with an example.

16. What is an abstract class? Give example.

17. What is a Package? Differentiate between Java API packages & user defined packages.

18. Explain the purpose of try and catch with syntax & exmples

19. Substantiate Jbutton and Jlabel with examples.

20. How to pass parameters to an applet? Explain with Example.

21. Write an applet that receives three numeric values as input from the user and display the
largest.
(6×5=30)
Part C
Answer any two questions.
Each question carries 15 marks.

22. Define token of a language. Explain the different tokens used in Java.

23. What is constructor overloading? Write a Java program to implement the constructor
overloading mechanism.

24. a)Differentiate between one-dimensional , two-dimensional arrays with appropriate syntax


& examples b)Write a Java program to sort numbers & sort names in 2 different arrays.

25. Differentiate between the following (a) JCheckBox and Jradiobutton (b) Jlist and
JComboBox
(2×15=30)

Page 2/2

Common questions

Powered by AI

Abstract classes in Java provide a blueprint for other classes, allowing for both complete and unimplemented methods. Unlike interfaces, which can only contain method declarations (until Java 8+), abstract classes can have member variables, fully defined methods, and constructors, allowing for shared code among related classes. Abstract classes are used when there is a common base with some shared implementation but not enough to use an interface alone. A scenario involving abstract classes might include a graphic application where 'Shape' is an abstract class with a 'draw()' method, but specific shapes implement their details while inheriting drawing logic .

A JTextField is a single-line text input component that is typically used for short input fields like text boxes for names or other short data entries. In contrast, a JTextArea is a multi-line area that can display more significant quantities of text, making it ideal for larger text inputs, such as comments or paragraphs. JTextArea does not support an ActionListener to handle when the enter key is pressed, unlike JTextField, which does. These key differences make JTextField suitable for forms where individual data points are entered, while JTextArea is utilized when allowing for freeform, multi-line input from the user .

Packages in Java are namespaces that organize classes and interfaces into a directory structure, grouped based on functionality, thus improving modularity, access control, and namespace management. Java API packages like 'java.util' and 'java.io' provide readily available core functionality across programs with extensive pre-built classes and interfaces. User-defined packages, created by developers, allow for custom organization specific to the project's needs, enabling encapsulation and reducing naming conflicts. The usage of both ensures code reuse, ease of maintenance, and better management of larger applications .

Static members in Java belong to the class rather than any particular object instance. They are defined with the 'static' keyword and include variables and methods shared among all instances of a class, thereby conserving memory. Static members are allocated memory once per class load rather than once per object instantiation, giving them a longer lifetime typically from the start of the program until it terminates. In contrast, instance members are created anew with each object instantiation and are accessible only through specific instances, ceasing to exist when the associated object is dereferenced and garbage collected .

Class members are accessed by creating an object of the class and using the object reference followed by the dot operator (.) and the member's name. For example, if 'MyClass' contains a member 'myMember', and an object 'myObject' is created as MyClass myObject = new MyClass(); then 'myMember' is accessed with myObject.myMember. This method is significant because it encapsulates data and operations that manipulate them, adhering to object-oriented programming principles and allowing for interaction with specific instances of classes .

Java applets are special Java programs designed to be embedded in web pages and executed by a Java-enabled web browser. A typical applet program extends the 'Applet' class and overrides methods like init(), start(), stop(), and destroy() to manage its life cycle. Its structure includes a user-defined class inheriting from 'Applet' with overridden methods to execute specific actions. Applets are historically significant in web applications for adding interactive features like animations and games, though their use has declined with the advent of more advanced web technologies such as HTML5 and JavaScript .

Java is considered platform-independent because of its ability to run on any machine equipped with a Java Virtual Machine (JVM). The Java compiler converts the source code into platform-independent bytecode, which the JVM then interprets and executes on any platform without modification. Robustness is achieved through Java's strong memory management, exception handling, and type-checking mechanisms during compile time, which reduce runtime errors. These features collectively support Java's reputation for reliability and cross-platform compatibility .

JCheckBox and JRadioButton both allow user interaction for selections but serve different purposes in an application interface. JCheckBox allows multiple selections as it represents a true/false setting, allowing users to check or uncheck independently. Conversely, JRadioButton is part of a ButtonGroup that limits selection to one option at a time, ensuring mutually exclusive choices within the group. Such differentiation is crucial when designing interfaces where users can choose multiple options independently or must choose only one from a set .

In Java, the 'try' and 'catch' blocks are used for handling exceptions that may be thrown during the execution of a program, thus preventing abrupt program termination. The 'try' block contains code that might throw an exception, while one or more 'catch' blocks follow to specify different types of exceptions they can handle. By catching and managing exceptions, these blocks allow a program to recover from unexpected events, handle errors gracefully, and thus improve overall program reliability and stability .

Constructor overloading in Java allows a class to have more than one constructor with different parameter lists. This feature is used to initialize object properties in different ways. Java differentiates constructors based on number and type of parameters. For example: class Car { String model; int year; // Default constructor Car() { model = "Unknown"; year = 0; } // Parameterized constructor Car(String m, int y) { model = m; year = y; } } Here, the 'Car' class has overloaded constructors allowing objects to be created with or without specifying model and year .

You might also like