0% found this document useful (0 votes)
198 views18 pages

AllPossibleQuestionBank (Desc&Obj) ..R22 OOPSJAVA 2324SEM1..14112023

This document contains a question bank for the subject "Object Oriented Programming Using Java" for the academic year 2023-24, semester 1. It includes questions from two units - Unit I and Unit II. For each unit, questions related to key concepts are provided along with their marks, course outcomes (CO) and bloom's taxonomy levels (BTL). The questions range from basic to advanced level and cover important topics like OOPs concepts, classes, inheritance, abstraction, interfaces, packages and I/O in Java.

Uploaded by

Vinay Kumar
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)
198 views18 pages

AllPossibleQuestionBank (Desc&Obj) ..R22 OOPSJAVA 2324SEM1..14112023

This document contains a question bank for the subject "Object Oriented Programming Using Java" for the academic year 2023-24, semester 1. It includes questions from two units - Unit I and Unit II. For each unit, questions related to key concepts are provided along with their marks, course outcomes (CO) and bloom's taxonomy levels (BTL). The questions range from basic to advanced level and cover important topics like OOPs concepts, classes, inheritance, abstraction, interfaces, packages and I/O in Java.

Uploaded by

Vinay Kumar
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
You are on page 1/ 18

UNITWIZE DESCRIPTIVE AND OBJECTIVE

QUESTION BANK

COMMON TO CSE, CSE(DS), AI&DS

SUBJECT: OBJECT ORIENTED PROGRAMMING USING


JAVA

AY 23-24 SEM-1 (R22)

Updated: 14.11.2023

1
OBJECT ORIENTED PROGRAMMING USING JAVA
AY 23-24 SEM-1 (R22)
UNIT-I (All Possible Questions)
S.
Questions Marks CO PO BTL
No
a). Why is Java known as platform independent? 1M 1 2 1
b). Differentiate this and this (). 1M 1 4 2
1 Define an Array. Write 2-D Array declaration and initialization
c). 4M 1 3 3
syntax.
d). Construct a Java Program for matrix multiplication 6M 1 5 4
a). Describe type casting? Explain with an example. 1M 1 1 1
b). Demonstrate different control structures with syntax and example. 1M 1 2 2
2
c). What are characteristics of an object in java. Explain with Example 4M 1 3 3
d). List and explain the Java buzzwords in detail 6M 1 4 4
a). What is difference between .class file and .java file 1M 1 3 1
b). Explain various data types in Java along with their size and range. 1M 1 2 2
c). Illustrate constructor overloading concept with an example 4M 1 5 3
3
Develop a java program to calculate the area and circumference of a
d). circle where the input from the keyboard. (area formula=pi*r*r, 6M 1 3 4
Circumference formula=2*pi*r, use java.lang.PI for pi value)
a). Define Abstraction and Encapsulation. 1M 1 5 1
b). Define recursion and explain. 1M 1 4 2
4
c). What are different Access Specifiers in Java. Explain in detail 4M 1 2 3
d). Explain about JVM's Garbage Collection in detail 6M 1 6 4
a). Define variable with example 1M 1 3 1
b). List and explain various types of variables? 1M 1 2 2
5 Develop a java program to check given number is
c). 4M 1 5 3
Armstrong number or not.
d). Explain about OOPS Paradigm. 6M 1 3 4
What is the size of char data type? Why does it differ from C
a). 1M 1 2 1
language?
6 b). Differentiate while loop and do-while loop. 1M 1 3 2
c). Illustrate about for and foreach loop with java codes. 4M 1 5 3
d). List out various types of operators in java with examples. 6M 1 4 4
Does Java support multi way selection statement? Justify your
a). 1M 1 2 1
answer.
b). Describe how to instantiate a class in Java program? 1M 1 6 2
7
Demonstrate objects as parameter to a constructor with example
c). 4M 1 3 3
program.
d). Explain in detail about java literals 6M 1 2 4
a). List the properties of a constructor. 1M 1 5 1
b). Explain Polymorphism and its types. 1M 1 3 2
Develop a program to create an object reverse number then use that
c). 4M 1 2 3
object for finding given number is palindrome or not.
8 Develop a java program to print the following pattern using for loop.
*
d). ** 6M 1 2 4
***
****

2
*****
a). Explain why java is more secured than other languages? 1M 1 2 1
b). What is byte code? When it will be generated 1M 1 3 2
9 what is the difference between instance variable, static variable, final
c). 4M 1 3
variable
d). Explain about Nested and Inner Classes 6M 1 3 4
a). What is String Literal Pool in Java 1M 1 2 1
b). What is JIT Compiler in java 1M 1 2 2
10 Develop a java program to check weather a given number is prime or
c). 4M 1 4 3
not.
d). Define a String. Explain String handling functions. 6M 1 3 4

UNIT-II (All Possible Questions)


S.
Questions Marks CO PO BTL
No
Define an interface and what are the default access specifiers and
a). 1M 2 1 1
modifiers applied to members of an interface.
b). What is abstract class? Write its syntax. 1M 2 2 2
1
c). Explore the benefits of Inheritance. 4M 2 3 3
Define single inheritance and multilevel inheritance with example
d). 6M 2 3 4
program.
How an interface be inherited to a class and to an interface with a
a). 1M 2 1 1
program?
b). Write about final keyword in java? 1M 2 4 2
2
c). Write a java program to demonstrate super keyword. 4M 2 3
Develop a single Java Program in which multilevel and hierarchical
d). 6M 2 3 4
inheritances used.
a). Define a Package? What is its use in java? Explain. 1M 2 2 1
b). Explain about Subtype and Substitutability 1M 2 2 2
c). Explain about the Forms of Inheritance 4M 2 4 3
3 What is a package and its types? How to define a package in Java?
Construct a Java Program to implement the package Operations
d). 6M 2 3 4
which has two classes Arithmetic and Relational with respective
methods into it, which are implemented by class Compute.
a). What is Object class? Explain Object class methods. 1M 2 4 1
b). Write the properties of abstract class. 1M 2 5 2
4
c). Differentiate between interface and abstract class. 4M 2 1 3
d). Differentiate between overloading and overriding. 6M 2 3 4
a). Define polymorphism. What are its types. 1M 2 2 1
What is the significance of the CLASSPATH environment variable
b). 1M 2 2 2
in creating/using a package?
5
c). Write a java program to demonstrate abstract class. 4M 2 2 3
Write a Java Program to receive inputs from Command Line and
d). 6M 2 3 4
display the arguments.
a). List Different sub-Classes of InputStream and OutputStream 1M 2 4 1
b). Demonstrate Nested Interface? 1M 2 3 2
6
c). Explain the Costs of Inheritance. 4M 2 2 3
d). Explain in detail all the possible ways of taking inputs from the user. 6M 2 2 4
a). What is the difference between abstract class and abstract method 1M 2 4 1
7 b). List the Random-access file operations. 1M 2 3 2
c). What are the forms of inheritance? Explain. 4M 2 3 3
3
d). What is overriding? Explain overriding with example program. 6M 2 2 4
a). Where do we use System.in 1M 2 3 1
b). Write a short note on String Tokenizer 1M 2 3 2
8 Write a Java Program for reading bytes from file using
c). 4M 2 4 3
FileInputStream
Create an interface with at least one method and implement that
d). 6M 2 2 4
interface.
a). What is the difference between print() and println() 1M 2 2 1
b). Brief about Scanner Class 1M 2 3 2
9 c). What are the methods available in the Character Streams? Discuss. 4M 2 5 3
Distinguish between Byte Stream Classes and Character Stream
d). 6M 2 3 4
Classes
a). Outline about BufferedReader Class 1M 2 2 1
b). Define upcasting with syntax. 1M 2 3 2
10
c). Write a simple java program to implement typecasting. 4M 2 4 3
d). Develop Java Program to illustrate Adhoc and Pure Polymorphisms. 6M 2 3 4

UNIT- III (All Possible Questions)


Qn
Question Marks CO PO BTL
No
a). Define an Exception. 1M 3 4 1
b). Differentiate Error and Exception. 1M 3 5 2
1 c). Elaborate Various Exception in Java. 4M 1 3
Explain Exception class hierarchy in Java. Construct a Java program
d). that includes a try block and a catch clause which processes the 6M 3 3 4
arithmetic exception generated by division-by-zero error.
a). Outline the purpose of finally keyword. 1M 3 2 1
b). Differentiate throw & throws keywords. 1M 3 2 2
2 Design a program to illustrate the use of multiple catch blocks for a try
c). 4M 2 3
block.
d). Construct a Java program to demonstrate Nested-try block. 6M 3 3 4
a). List any four unchecked exceptions. 1M 3 4 1
b). Characterise printStackTrace() method 1M 3 3 2
3 Interpret re-throwing exception? Demonstrate with a suitable scenario for
c). 4M 2 3
this.
d). Develop a java program to handle ArrayIndexOutOfBoundsException. 6M 3 2 4
a). Describe NullPointerException in java 1M 3 4 1
b). Differentiate Built-in and User defined Exceptions 1M 3 3 2
4 c). Illustrate briefly the usage of five keywords in exception handling 4M 3 3
Compose a java program that illustrates the application of multiple
d). 6M 3 2 4
catch statements.
a). Interpret about NegativeArraySizeException 1M 3 3 1
b). Differentiate between Checked and UnChecked Exceptions. 1M 3 3 2
5
c). Differentiate Logical Errors and Runtime Errors with sample Codes. 4M 4 3
d). Develop a java program to handle NumberFormatException 6M 2 4
a). Describe the life cycle of a Thread. 1M 3 2 1
Differentiate between multiprocessing and multithreading. What is to
b). 1M 3 3 2
6 be done to implement these in a program?
Develop a java program to create two threads, one for even numbers
c). 4M 5 3
and other for odd numbers.

4
Construct a java program to demonstrate how to synchronize a share
d). 6M 3 3 4
resource in java.
a). Interpret synchronization and why is it important? 1M 3 2 1
b). Characterize to set priorities for threads? 1M 3 3 2
7 Summarize 're-throwing' exception? Discuss a suitable scenario for
c). 4M 4 3
this.
d). Construct a java program to explain thread priorities usage. 6M 3 3 4
a). Summarize methods of Inter thread communication. 1M 3 3 1
b). Differentiate Thread based and Process Based Multi-Threading 1M 3 4 2
8 Summarize the differences between thread-based multitasking and process-
c). 4M 3
based multitasking.
3 5
Compose a java program to create three threads in your program and
d). 6M 4
context switch among the threads using sleep functions.
a). Differentiate between thread and process 1M 3 2 1
b). Distinguish the thread based pre-emptive multitasking? 1M 3 4 2
Design a program that creates a thread that forces pre-emptive scheduling
9 c). 4M 3 3
for lower priority threads.
Discuss and differentiate the ways of creating threads in java using
d). 6M 3 5 4
the thread class and the Runnable interface.
a). Factor how to achieve synchronization among threads? 1M 3 2 1
b). Characterise the start and stop a thread? 1M 3 1 2
Justify the producer - consumer problem using inter - thread
10 c). 4M 3 3
communication
Develop a program that creates two threads. Fist thread prints the
d). numbers from 1 to 100 and the other thread prints the numbers from 6M 3 4 4
100 to 1.

UNIT - IV (All Possible Questions)


Qn
Question Marks CO PO BTL
No
a). Quote a short notes about an event and its sources. 1M 4 3 1
b). Outline short notes on Delegation Event Model. 1M 4 4 2
1
c). Explain about Event Classes. 4M 4 2 3
d). Develop a java program to handle KeyBoard events in java 6M 4 2 4
a). Grade few Examples of GUI based Applications 1M 4 3 1
b). Classify some limitations of AWT. 1M 4 1 2
2 c). List some advantages of GUI over CUI 4M 4 3 3
Express about an Adapter Class? Develop a java program that uses
d). 6M 4 2 4
Adapter classes to perform event handling.
a). Outline some Components in java.awt.Component class. 1M 4 3 1
b). Explain about Adaptor Classes 1M 4 4 2
3 Distinguish the events of the mouse and keyboard can be handled? Explain
c). 4M 4 2 3
with an example
Infer the AWT hierarchy with a neat Diagram and explain each
d). 6M 4 3 4
component
a). Outline the steps involved in Event handling. 1M 4 4 1
b). Interpret about Event Listeners. 1M 4 4 2
4 c). Review about Model-View-Controller (MVC) Architecture. 4M 4 3 3
Create a user interface to collect data from customer for opening an
d). account in a bank. Use all possible swing components and layout 6M 4 4 4
manager for your interface design

5
a). Generalize is Java Foundation Classes 1M 4 3 1
b). Describe Keyboard Events from Component class. 1M 4 3 2
5 Factor the role of Event Handling in AWT. Provide an example of
c). 4M 4 4 3
handling a mouse click event.
d). Describe in detail about the various event listener interfaces. 6M 4 3 4
a). Judge are the limitations of AWT? 1M 4 3 1
b). Tabulate the Menu Items. 1M 4 2 2
6 c). Identify is the difference between Boarder layout and Grid layout? 4M 4 1 3

d). Develop a java program to design a scientific calculator using AWT. 6M 4 5 4

a). Brief about dialog box in AWT. 1M 4 5 1


b). Brief about Border Layout? 1M 4 4 2
7 Discriminate difference between actionListener and
c). 4M 4 3 3
actionPerformer?
Build a simple calculator applet that can perform basic arithmetic
d). 6M 4 3 4
operations.
a). Brief about scrollable component (e.g., TextArea) in AWT 1M 4 1 1
b). Identify the difference between Boarder layout and Grid layout? 1M 4 2 2
8 c). Explain various layout managers in JAVA 4M 4 3 3
Code a program to create a frame window that responds to mouse
d). 6M 4 5 4
clicks.
a). Summarize the uses of Layout Managers? 1M 4 3 1
b). Outline why a Layout Architecture is needed. Explain your view point. 1M 4 2 2
9 Describe with sample code how create a Java AWT Frame in two
c). 4M 4 3 3
ways
Explain Grid Layout, Flow Layout, Card layout, Border Laout and
d). 6M 4 4 4
Grid bag Layout.
a). Describe a Layout Manager. 1M 4 3 1
Contrast the difference between Grid Layout and Grid Bag Layout?
b). 1M 4 3 2
Explain with figures.
10
c). Create a Java application that employs AWT to display a dialog box. 4M 4 4 3
Construct a Java program with AWT that utilizes graphics to draw
d). 6M 4 3 4
basic shapes (e.g., rectangles, circles).

UNIT - V (All Possible Questions)


S.
Questions Marks CO PO BTL
No
a). Review an Applet? 1M 5 3 1
b). Summarise about MVC architecture in Java? 1M 5 1 2
1
c). Discuss the security concerns related to Java Applets. 4M 5 2 3
d). Explain the life cycle of an Applet with suitable program. 6M 5 3 3
a). Justify why do applet classes need to be declared as public? 1M 5 5 1
Figure out is the difference between stop() and destroy() in Applet
b). 1M 5 5 2
lifecycle
2 Create a Java Applet with a button. Implement an action listener to
c). 4M 5 4 3
change the applet's background color when the button is clicked.
Explain How do pass parameters to Applets? Write a code to
d). 6M 5 3 4
implement small Swing Applet.
a). Interpret the concept of applet parameters. 1M 5 1 1
3 b). Factor public void paint(Graphics g) method. 1M 5 2 2
c). Generalize the essential HTML tags used to embed a Java applet in a web 4M 5 3 3
6
page? Provide a brief explanation of each tag's purpose.
Design a Java Applet that displays a simple "Hello, World!"
d). 6M 5 3 4
message.
a). List the packages to create java applet with 1M 5 2 1
b). Describe the methods to set the size of a Java applet window. 1M 5 3 2
4 Formulate parameters passed to an applet, and how can they be
c). 4M 5 5 3
accessed within the applet code?
Create a simple applet to display a smiley picture using Graphics
d). 6M 5 5 4
class methods
a). Brief how Swing is differs from Applet in Java. 1M 5 4 1
b). Discriminate how applets differ from application program 1M 5 3 2
5
c). Differentiate between Java Application and Java Applet 4M 5 3 3
d). Infer various classes used in creating a swing menu? 6M 5 2 4
a). Summarise about JButton and a JTextField 1M 5 2 1
b). Contrast the differences between JList, JCombo Box components. 1M 5 3 2
6
c). Examine the subclasses of JButton class of swing package? 4M 5 3 3
d). Draw the hierarchy of Java Swing classes 6M 5 3 4
a). Express about Tabbed Panes (JTabbedPane). 1M 5 4 1
List out any four commonly used methods of Graphics class and
b). 1M 5 1 2
explain.
7 Use a 'JOptionPane' to create a dialog box that prompts the user to
c). 4M 5 2 3
enter their name.
Design a user interface to collect data from the student for admission
d). 6M 5 3 4
application using swing components.
a). Outline about swing in Java? 1M 5 3 1
b). Describe about container class? 1M 5 5 2
8 c). Design a Java Applet that loads and displays an image. 4M 5 4 3
Generalize How the events of the mouse and keyboard can be handled?
d). Explain with an example.
6M 5 2 4
Differentiate between JFrame and JPanel in Swing. When would you
a). 1M 5 1 1
use each of these classes?
b). List out the differences Between AWT and Swing. 1M 5 3 2
9 c). Demonstrate the different types of Event Listeners supported by java. 4M 5 2 3
Design a program using an applet which will print “key pressed” on the
status window when you press the key, “key released” on status window
d). 6M 5 3 4
when you release the key and when you type the character it should print
“hello” at co-ordinates (50,50) on Applet.
Explain How do you initialize Swing components in Java? Provide a
a). 1M 5 2 1
code snippet for initializing a JButton with the label "Click Me."
Explain about the following lines. frame.setJMenuBar(menuBar);
10 b). 1M 5 2 2
frame.setSize(400, 300); frame.setVisible(true);
c). Differentiate between JCheckbox and JRadio Button 4M 5 4 3
d). Interpret a java program for MenuBar with swings 6M 5 3 4

7
VIGNAN INSTITUTE OF TECHNOLOGY & SCIENCE::DESHMUKHI
UNITWIZE OBJECTIVE QUESTIONS
COMMON TO CSE, CSE(DS), AI&DS
SUBJECT: OBJECT ORIENTED PROGRAMMING USING JAVA

8
Updated 14.11.2023
OBJECT ORIENTED PROGRAMMING USING JAVA
23-24 SEM1 (R22)
OBJECTIVE QUESTIONS
UNIT-I

MULTIPLE CHOICE QUESTIONS


CHOOSE THE CORRECT ANSWER:
1. Which of the following is a valid declaration of an object of class Box? [ ]
A. obj = new Box(); B. Box obj = new Box;
C. Box obj = new Box(); D. new Box obj;

2. Which of these operators have highest precedence? [ ]


A. () B. ++
C. * D. >>

3. When does method overloading is determined? [ ]


A. At run time B. At Compile Time
C. At coding time D. At object creation time

4. Which concept of Java is achieved by combining methods and [ ]


attribute into a class?
A. Encapsulation B. Inheritance
C. Polymorphism D. Abstraction

5. Which of these operators is used to allocate memory for an object? [ ]


A. malloc B. alloc
C. new D. give

6. What is the process of defining more than one method in a class differentiated by [ ]
method signature?
A. Method overriding B. Method overloading
C. Method bounding D. Method chaining

7. What is the return type of Constructors? [ ]


A. Int B. float
C. Void D. Must not specify any return type

8. Which keyword is used by the method to refer to the object that invoked it? [ ]
A. import B. catch
C. abstract D. this

9. Which of these access specifiers must be used for main() method? [ ]


A. Private B. Catch
C. Abstract D. This

10. Which of these keywords is used to access a member of class before the object [ ]
of that class is created?
A. public B. private
C. static D. protected

FILL IN THE BLANKS


9
11. What is the output of the above program .
class increment {
public static void main(String args[ ]){
int g = 3; System.out.print(++g * 8);}}

12. What will be the output of the following Java program?


class Output{
public static void main(String args[]){
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length - 2; ++i)
System.out.println(arr[i] + " ");}}

13. What is the extension of compiled java classes?

14. Which class is a superclass of every class in Java?

15. Automatic type conversion is possible in which of the possible cases?

16. _____________ is a concept in OOP which hides unimportant implementation details from other
objects.

17. Use of _____________ statement creates an unconditional jump within program.

18. Java defines four types of integers:_________________________.

19. String literal is a sequence of characters enclosed within _____________ quotation marks.

20. __________ symbol is used to implement ternary operator in java.

KEY FOR UNIT-I


1. C 2. A 3. B 4. A 5. C
6. 7. D 8. D 9. B 10. C
11. 32 12. 123
13. class 14. Object Class
15. Int to long 16. Encapsulation
17. goto 18. Byte, short, int, long
19. double 20. ?:

10
OBJECTIVE QUESTIONS FOR UNIT-II
MULTIPLE CHOICE QUESTIONS
CHOOSE THE CORRECT ANSWER:
1. Which of these is a mechanism for naming and visibility control of a class and its [ ]
content?
A. Object B. Packages
C. Interfaces D. JRE

2. Which of these access specifiers can be used for a class member so that they can [ ]
be accessed by a different class in the same package?
A. public B. protected
C. No Modifier D. No Modifier or protected or public

3. Which of the following is an incorrect statement about packages? [ ]


A. Package defines a namespace in B. A package can contain another
which classes are stored package with in it

C. Java uses file system directories to D. A package can be renamed


store packages without renaming the directory in
which the classes a restored

4. Which of the following is the correct way of inheriting an interface A by [ ]


another interface B?
A. interface B extends A{} B. interface B implements A{}
C. interface B imports A{} D. interface A implements
B{}

5. Which of these can be used to fully abstract a class from its implementation? [ ]
A. Objects B. Packages
C. Interfaces D. encapsulation

6. Which of the following is the correct way of implementing an interface salary by class [ ]
manager?
A. class manager extends salary{} B. class manager implements salary{}
C. class manager imports salary{} D. class manager: public salary

7. Which of the following is an in correct statement about packages? [ ]


A. Interfaces specifies what class must B. Interfaces are specified public if
do but not how it does they are to be accessed by any code
in the program
C. All variables in interface are D. All variables are static and
implicitly final and static methods are public if interface
is defined pubic

8. Which of these packages contain classes and interfaces used for input & output [ ]
operations of a program in java?
A. java.util B. java.lang
C. java.io D. java.net

9. Which of these methods is used to find whether a given element is a File or a [ ]


Directory?
A. IsFile() B. isFile()
C. Isfile() D. isfile()

10. Which of these classes has methods to read primitive datatype types from a file? [ ]
11
A. InputStream B. FileInputStream
C. DataInputStream D. FileReader

FILL IN THE BLANKS


11. _________is the access specifier that can be used for a class so that its members can be accessed sub
classes in a different package.

12. ____________type of inheritance is not supported by java

13. ___________ keyword is used by a class to use an interface defined previously.

14. ________keyword is used to define interfaces in java

15. The full form of API is _____________________

16. Can we define a variable inside an interface? Yes/No _______

17. An inner class is a ___________type of nested class

18. Nested classes are divided in to ___________ & ______________

19. A Nested class can have its own static members_____________(True/False)

20. __________________ class is defined as incomplete that requires further specification

KEY FOR UNIT-II


1. B 2. D 3. D 4. A 5. C
6. B 7. B 8. C 9. D 10. C
11. Protected 12. Multiple inheritance
13. implements 14. Interface
15. Application Program Interface 16. Yes
17. Non-Static 18. Non Static & StatiC
19. False 20. abstract

12
OBJECTIVE QUESTIONS FOR UNIT-III
CHOOSE THE CORRECT ANSWER:
1. When does Exceptions arises in code sequence [ ]

A. Runtime B. compilation time


C. can occur any time D. none of the above

2. Which of the keyword is not a part of Exception handling mechanism [ ]

A. try B. Finally
C. thrown D. catch

3. Which of these keyword is used to manually throw an exception [ ]


A. try B. Finally
C. thrown D. catch

4. Which keyword when applied on a method indicates that only one thread should [ ]
execute the method at a time.
A. volatile B. synchronized
C. Native D. static

5. Which method will wait for a thread to terminate. [ ]


A. sleep() B. run()
C. join() D. start()

6. Which of these is superclass for all the exceptions in java [ ]


A. RuntimeException B. Exception
C. Throwable D. Catchable

7. Which of these keywords used to monitor the exception [ ]


A. try B. finally
C. throw D. catch

8. Which of these are types of multitasking? [ ]

A. Process based B. Thread based


C. Process and Thread based D. None of the mentioned

9. What will happen if two thread of the same priority are called to be processed [ ]
simultaneously?

A. Anyone will be executed first B. Both of them will be executed


lexographically simultaneously

C. None of them will be D. It is dependent on the


executed operating system

10. Which of these statements is incorrect? [ ]


A. By multithreading CPU idle time B. By multitasking CPU idle time is
is minimized, and we can take minimized, and we can take
maximum use of it maximum use of it
C. Two thread in Java can D. A thread can exist only in two states,
have the same priority running and blocked

13
FILL IN THE BLANKS
11. __________________ exceptions are Unchecked exception

12. The keyword to synchronize methods in java is __________________.

13. __________________ is the super class for all exception classes in java

14. __________________ keyword is used to by the calling function to guard against the exception
that is thrown by called function.

15. __________________ exception is thrown when divide by zero statement executes

16. What is the value of the normal thread priority___________.

17. ________ Exception will be thrown if you try to invoke a method on a null reference.

18. _________Exception will be thrown if you try to open a file which do not exist.

19. _________method is used by a thread to voluntarily give control to another thread with same
priority.

20. __________class contains wait(), notify() and notifyAll().

KEY FOR UNIT-III


1. A 2. C 3. C 4. B 5. C
6. C 7. A 8. C 9. D 10. D
11. RuntimeException 12. synchronized
13. Throwable 14. throws
15. ArithmeticException 16. 5
17. NullPointerException 18. FileNotFoundException
19. Yield() 20. Object class

14
OBJECTIVE QUESTIONS FOR UNIT-IV
CHOOSE THE CORRECT ANSWER:
1. components are referred to as heavy weight components than swings [ ]
A. Graphics B. Event
C. AWT D. Layout

2. __________ Interface defines the action performed method that is invoked when an [ ]
action event occurs.
A. ActionListener B. ItemListener
C. AdjustmentListener D. key Listener

3. _____________class provides an empty implementation of Listener Interface. [ ]


A. Anonymous B. Listener
C. Adapter D. none

4. A___________manager automatically position components with in a container [ ]


A. Container B. Component
C. Layout D. Event

5. ___________are used to select continuous values between a specified minimum and [ ]


maximum.
A. Scroll bar B. check box
C. Dialog D. Menu bar

6. AWT stands for ? [ ]


A. All Window Toolkit B. Abstract Work Toolkit
C. Abstract Window Toolkit D. Abstract Window Text

7. The subclass of a java.awt.Component class is known as a _________? [ ]


A. system B. component
C. container D. component manager

8. What is the super class of all components of Java? [ ]


A. java.all.Component B. all.awt.Component
C. java.awt.Component D. awt.Component

9. The subclass of a java.awt.Container class is known as a container. [ ]


A. True B. False
C. Can be True or False D. Can not say

10. How many layout managers defined in java.awt package? [ ]


A. 2 B. 3
C. 4 D. 5

FILL IN THE BLANKS


11. A _________________ dictates the style of arranging the components in a container.

12. ________________ method used to place some text in the text field?

13. ___________________________ is the listener used to handle the events of a text field?

14. __________________ method used to change the foreground (text) color of components like
15
text field?

15. ___________ method used to retrieve the label of a button

16. In Graphics class ______________________________ method is used to draws a rectangle


with the specified width and height?

17. ________________object can be constructed to show any number of choices in the visible
window?

18. ___________ class is used for this Processing Method processActionEvent( )?

19. ______________ is a component in AWT that can contain another components like buttons,
textfields, labels etc.?

20. _______________ are passive controls that do not support any interaction with the user?

KEY FOR UNIT-5


1. C 2. A 3. C 4. C 5. A
6. C 7. B 8. C 9. A 10. D
11. layout manager 12. setText(String str)
13. java.awt.event.ActionListener interface 14. setForeground(Color clr)
15. getLabel() 16. public void drawRect(int x, int y, int
width, int height)
17. List 18. Button,List,MenuItem
19. Container 20. Labels

16
OBJECTIVE QUESTIONS FOR UNIT-V
CHOOSE THE CORRECT ANSWER:
1. Which of these functions is called to display the output of an applet? [ ]
A. display() B. paint()
C. displayapplet() D. printapplet()

2. Which of these methods can be used to output a string in an applet? [ ]


A. display() B. print()
C. drawstring() D. Transient()

3. Which of these methods is a part of Abstract Window Toolkit (AWT) ? [ ]


A. display() B. print()
C. drawstring() D. Transient()

4. Applets cannot make network connection exception to the server host from which it [ ]
originated.
A. True B. False
C. True or False D. Cannot Say

5. What invokes immediately after the start() method and also any time the applet needs to [ ]
repaint itself in the browser?
A. stop() B. init()
C. paint() D. destroy()

6. An applet can be executed using_______ [ ]


A. appletviewer B. browser
C. Both a & b D. None

7. ____________class defines a number of drawing functions. [ ]


A. Graphics B. Applet
C. Swing D. Frame

8. ____________method is called only once during the run time of your applet [ ]
A. start() B. init(
C. stop() D. paint()

9. ______________is an API to develop GUI or window-based applications [ ]


A. AWT B. Applet
C. Swing D. All the above

10. ___________method used for re painting an Applet is [ ]


A. paint() B. repaint()
C. Both a & b D. None

FILL IN THE BLANKS


11. A small program that can run over the internet is called_________ .

12. The default layout out of a Frame is_________

13. _____________class is super class of all the events.

14. ______________is the top level container that is commonly used for swing applets.
17
15. _______________class helps us to avoid the implementation of abstract methods under
WindowListener while creating a Window

16. Swings contains_________Components.

17. ___________is the combination of drop-down list and text field.

18. _________methods of Applet executes exactly once in its life-cycle.

19. _____________is to be registered for Key Handling Events.

20. _____________is the abstract method present under ActionListener.

KEY FOR UNIT-5


1. B 2. C 3. B 4. A 5. C
6. C 7. A 8. B 9. D 10. C
11. Applet 12. BorderLayout
13. EventObject 14. JFrame
15. WindowAdapter 16. LightWeight
17. JComboBox 18. init() & destroy()
19. KeyListener 20. actionPerformed()

18

You might also like