PDF&Rendition 1
PDF&Rendition 1
1 1 1 A OBJ CO1 R E 1
_________ is used to find and fix bugs in the Java programs.
A. JVM B. JRE
C. JDK D. JDB
Answer is : D
2 1 1 A OBJ CO1 R E 1
________is a technique of hiding unnecessary details from the user.
A. Abstraction B. Object
Answer is : A
3 1 1 A OBJ CO1 R E 1
_________represents the data (value) of an object.
A. State B. Behavior
Answer is : D
4 1 1 B DESC CO1 U E 4
How does Object-Oriented Programming enhance modern software development, and what practical applications can you
find in today’s technology that utilizes its core features?
5 1 1 C DESC CO1 Ap M 12
In the context of developing scalable and maintainable softwaresolutions, how does the Object-Oriented Programming
(OOP)paradigm address the complexities of modern applications? Could youalso detail the core features of OOP and
explain how they contribute toefficient and effective programming practices?
6 1 2 A OBJ CO1 U E 1
________ is a group of objects which have common properties data visualization.
A. Fields B. Methods
C. Class D. Blocks
Answer is : C
7 1 2 A OBJ CO1 U E 1
_____________is the process of wrapping code and data together into a single unit.
A. Class B. Objects
C. Methods D. Encapsulation
Answer is : D
8 1 2 A OBJ Which access should a constructor be defined, so that object of the class can be created in any function? CO1 R E 1
Public Protected
A. B.
Private
C. D. Any access specifier will work
Answer is : A
9 1 2 A OBJ CO1 R E 1
________ is the example of object-oriented programming is to implement?
A. Object B. Classes
Answer is : D
10 1 2 B DESC CO1 Ap M 4
Create a class for calculator and write methods for finding sum, difference, product and quotient. All methods should take
2 numbers as input and return one integer.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 1/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
11 1 2 C DESC CO1 Ap M 12
Develop a Java application to generate Electricity bill. Createa class with the following members: Consumer no.,
consumername, previous month reading, current month reading, type of
EB connection (i.e domestic or commercial). Compute the bill amountusing the following tariff.If the type of the EB
connection is domestic, calculate the amount tobe paid as follows:
i. First 100 units - Rs. 1 per unitii. 101-200 units - Rs. 2.50 per unitiii. 201 -500 units - Rs. 4 per unitiv. > 501 units - Rs.
6 per unit
12 1 3 A OBJ CO1 R E 1
If same message is passed to objects of several different classes and all of those can respond in a different way, what is
this feature called?
A. Inheritance B. Overloading
C. Polymorphism D. Overriding
Answer is : C
13 1 3 A OBJ CO1 R E 1
The languages that support classes but not Polymorphism is called ?
Answer is : C
14 1 3 A OBJ CO1 U M 1
Find the output of the following program
short x = 10;
x = x * 5;
System.out.print(x);
A. 50 B. 10
Answer is : C
15 1 3 B DESC CO1 Ap M 4
Develop a class named student and write a program to read marks as input and return total as output .Another method to
take total and number of subject as input and return average.
16 1 3 C DESC CO1 Ap E 12
Create a Java class that has multiple constructors with differentparameter lists (constructor overloading). Show how each
constructorcan be used to initialize an object with different sets of data.
17 1 3 C DESC CO1 Ap E 12
Show the string “madam” is palindrome or not by defining the functionality of the program using the methods . The
methods are theset of instructions that we want to perform and these instructions execute at runtime and perform the
specified task.
18 1 4 A OBJ Which among the following is called first, automatically, whenever an object is created? CO1 R E 1
Class Constructor
A. B.
New
C. D. Trigger
Answer is : B
19 1 4 A OBJ CO1 R E 1
__________system property stores installation directory of JRE?
A. user.home B. java.class.path
C. java.home D. user.dir
Answer is : B
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 2/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
20 1 4 A OBJ CO1 R E 1
__________environment variable is used to set java path.
A. JAVA B. JAVA_HOME
C. CLASSPATH D. MAVEN_HOME
Answer is : B
21 1 4 B DESC CO1 U M 4
Create a Java program to print an inverted pyramid pattern
*****
***
22 1 5 A OBJ _________is the use of Access modifier "pubic" in Java language. CO1 R E 1
Answer is : B
23 1 5 A OBJ CO1 R E 1
Every statement in Java language should end with a____
C. Semicolon D. Colon
Answer is : C
24 1 5 A OBJ CO1 R E 1
All methods and variables in Java language are kept inside a_____
Answer is : B
25 1 5 A OBJ CO1 R E 1
________ is the need to mention "static" before main method.
Answer is : C
26 1 5 B DESC CO1 Ap E 4
In today’s coding environment, understanding the different types of operators is crucial for effective programming. Can
you list and explain the various types of operators available in Java and their uses?
27 1 5 B DESC CO1 Ap M 4
Write a Java program that uses method overloading to perform basic arithmetic operations (addition, subtraction,
multiplication, division) with various types of inputs, such as integers and doubles?
28 1 5 C DESC CO1 Ap E 12
Provide some key components of the Java environment and how they interact to support the development, execution, and
management of Java applications?
29 1 6 A OBJ CO1 U M 1
Find the output of the following programint
Integer = 24;
System.out.print(Integer);
System.out.print(String);
C. I D. 24I
Answer is : D
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 3/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
30 1 6 A OBJ CO1 U M 1
Find the output of the following program
byte x = 127;x++;x++;
System.out.print(x);
A. -127 B. 127
C. 129 D. 2
Answer is : A
31 1 6 A OBJ ______is the size of float and double in java? CO1 U E 1
A. 32 and 64 B. 32 and 32
C. 64 and 64 D. 64 and 32
Answer is : A
32 1 6 B DESC CO1 Ap M 4
Create a Circle class with properties for radius. Implement constructors to initialize the radius and methods to calculate
the area and circumference.
33 1 6 C DESC CO1 Ap E 12
Simplify the development of wide variety of applications and it is necessary to understand the basic structure of Java
program indetail. In this section, discuss the basic structure of a Java program.At the end of this you will able to develop
the Hello world Javaprogram , easily.
34 1 7 A OBJ CO1 R E 1
Select the valid statement.
Answer is : B
35 1 7 A OBJ Select the valid statement to declare and initialize an array. CO1 R M 1
Answer is : B
36 1 7 A OBJ CO1 R M 1
_______ will be the error in the following Java code.
Byte b=50;
b=b*50;
A. b cannot contain value 50 B. b cannot contain value 100, limited by its range
b) Char
c) Int
d) Float
38 1 7 C DESC CO1 U E 12
a)Solve the following Justify the statement - Default constructor will not have anyparameters where as parameterized
constructor can have one or moreparameters. copy constructor is a special kind of constructor where oldobject is passed
as a argument for new object.(6)
b)Develop a class with constructor to initializetwo numbers inconstructor and write methods to return quotient and
reminder of thosetwo numbers. (6)
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 4/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
39 1 8 A OBJ CO1 U E 1
A class member declared protected becomes a member of subclass of which type?
Answer is : B
40 1 8 A OBJ CO1 Ap M 1
What will be the output of the following Java code?
class San{
s.m1(20,20);
Answer is : C
41 1 8 A OBJ __________is the biggest reason for the use of Polymorphism. CO1 Ap M 1
43 1 8 B DESC CO1 U E 4
Identify the operators to perform various operations like addition, subtraction multiplication, and division which are
fundamental mathematical operations.
44 1 8 C DESC CO1 Ap E 12
Evaluate a Java program to find a smallest number in the given array by using one dimensional array and two dimensional
array.
C. To initialize the object in different ways D. To differentiate one constructor from another
Answer is : C
46 1 9 A OBJ The static member functions __________________ CO1 R E 1
A. Have access to all the members of a class B. Have access to only constant members of a class
C. Have access to only the static members of a class D. Have direct access to all other class members also
Answer is : C
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 5/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
47 1 9 A OBJ Which component is used to compile, debug and execute the javaprograms? CO1 R E 1
A. JRE B. JIT
C. JDK D. JVM
Answer is : C
48 1 9 A OBJ What is the extension of java code files? CO1 R E 1
A. .js B. .txt
C. .class D. .java
Answer is : D
49 1 9 B DESC CO1 An E 4
Describe the different access modifiers available in Java, such as private, protected, and public, and how they control
access to classes, methods, and variables?
50 1 9 B DESC CO1 An M 4
In the context of Java development, what is the Java Development Kit (JDK), and how does it facilitate the process of
building and running Java applications? Could you detail its key components and their roles in the development workflow?
Methods Constructors
A. B.
Answer is : C
52 2 1 A OBJ CO2 R E 1
Can method overloading be achieved by changing the return type of the method?
Yes, method overloading can be achieved by changin g No, method overloading cannot be achieved by changing
A. B.
the return type of the method the return type of the method
Answer is : B
53 2 1 A OBJ CO2 R E 1
What happens if two methods have the same name and parameters but different return types?
Public members
C. D. All the members
Answer is : D
55 2 1 B DESC CO2 Ap E 4
Differentiate method Overloading and method Overriding in Java?
56 2 1 C DESC CO2 An M 12
Write a java program to perform addition and concatenation operation by overloading a method sum().whether operator
can overload in java. Justify.
Increases Decreases
A. B.
Doesn’t affect
C. D. Slightly decreases
Answer is : A
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 6/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
58 2 2 A OBJ Which feature of OOP reduces the use of nested classes? CO2 R E 1
Encapsulation Inheritance
A. B.
Binding
C. D. Abstraction
Answer is : B
59 2 2 A OBJ CO2 R E 1
Which among the following best describes a nested class?
Answer is : A
60 2 2 B DESC CO2 Ap M 4
Write a Java program to check whether two objects are equal by passing object as a parameter.
61 2 3 A OBJ CO2 R E 1
If class B is sub class from class A then which is the correct syntax?
Answer is : B
62 2 3 A OBJ CO2 R E 1
Which class cannot be sub classed?
Answer is : A
63 2 3 A OBJ CO2 R E 1
Order of execution of constructors in Java Inheritance is
Answer is : A
64 2 3 B DESC CO2 An M 4
Create a class with a method that prints "This is parent class" and its subclass with another method that prints "This is
child class". Now, create an object for each of the class and call
1 - method of parent class by object of parent class
2 - method of child class by object of child class
3 - method of parent class by object of child class
65 2 3 C DESC CO2 An D 12
Create a class named 'Member' having the following members:
Data members
1 - Name
2 - Age
3 - Phone number
4 - Address
5 - Salary
It also has a method named 'printSalary' which prints the salary of the members.
Two classes 'Employee' and 'Manager' inherits the 'Member' class. The 'Employee' and 'Manager' classes have data
members 'specialization' and 'department' respectively. Now, assign name, age, phone number, address and salary to an
employee and a manager by making an object of both of these classes and print the same.
66 2 4 A OBJ CO2 U M 1
The concept of multiple inheritance is implemented in Java by
A. Only II B. I and II
Answer is : C
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 7/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
67 2 4 A OBJ CO2 R M 1
What is the purpose of the 'super' keyword in Java?
A. To call the constructor of the parent class B. To call a method of the child class
Answer is : A
68 2 4 A OBJ CO2 R M 1
What is a multilevel inheritance in Java?
A. A class extends two or more classes B. Two or more classes extend the same class
70 2 4 C DESC CO2 Ap M 12
Create a class named 'Member' having the following members:
Data members
1 - Name
2 - Age
3 - Phone number
4 - Address
5 - Salary
It also has a method named 'printSalary' which prints the salary of the members.
Two classes 'Employee' and 'Manager' inherits the 'Member' class. The 'Employee' and 'Manager' classes have data
members 'specialization' and 'department' respectively. Now, assign name, age, phone number, address and salary to an
employee and a manager by making an object of both of these classes and print the same.
A. Abstraction B. Encapsulation
Answer is : C
72 2 5 A OBJ Which of this keyword can be used in a subclass to call the constructor of super class? CO2 R M 1
super this
A. B.
extent
C. D. extends
Answer is : A
73 2 5 A OBJ Which of these keywords can be used to prevent Method overriding? CO2 R M 1
static constant
A. B.
protected
C. D. final
Answer is : D
74 2 5 A OBJ CO2 R E 1
Which of the following statements regarding abstract classes are true?
76 2 5 B DESC CO2 Ap E 4
Write a method that should not be overridden by subclasses.
77 2 5 C DESC CO2 Ap M 12
Write a Java program to create a class Vehicle with a method called speedUp(). Create two subclasses Car and Bicycle.
Override the speedUp() method in each subclass to increase the vehicle's speed differently.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 8/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
78 2 6 A OBJ CO2 R M 1
Which of the following class definitions defines a legal abstract class?
C. abstract class A { abstract void unfinished(); } D. public class abstract A { abstract void unfinished(); }
Answer is : C
79 2 6 A OBJ Please question here CO2 U M 1
Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a defaultconstructor. Which of the
following is correct?
A. 1 and 2 B. 2 and 4
C. 3 and 4 D. 1 and 3
Answer is : B
80 2 6 A OBJ CO2 R E 1
Which is/are false statements
Answer is : C
81 2 6 A OBJ Which of these is a mechanism for naming and visibility control of a class and its content? CO2 R E 1
A. Object B. Packages
Answer is : B
82 2 6 B DESC CO2 An M 4
Create an abstract class 'Parent' with a method 'message'. It has two subclasses each having a method with the same
name 'message' that prints "This is first subclass" and "This is second subclass" respectively. Call the methods 'message'
by creating an object for each subclass.
83 2 6 B DESC CO2 U E 4
How do interfaces differ from abstract classes
84 2 6 C DESC CO2 An M 12
Develop a Java program to create an abstract class Shape with abstract methods calculateArea() and calculatePerimeter().
Create subclasses Circle and Triangle that extend the Shape class and implement the respective methods to calculate the
area and perimeter of each shape.
85 2 6 C DESC CO2 An M 12
Create a Java program to create an abstract class Animal with abstract methods eat() and sleep(). Create subclasses Lion,
Tiger, and Deer that extend the Animal class and implement the eat() and sleep() methods differently based on their
specific behavior.
86 2 6 C DESC CO2 Ap M 12
Illustrate final method and final class with example
Answer is : C
88 2 7 A OBJ Which of the following package stores all the standard java classes? CO2 R E 1
A. lang B. java
C. util D. java.packages
Answer is : A
89 2 7 A OBJ CO2 R E 1
A. mypackage B. javapackage
C. util D. program
Answer is : C
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 9/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
90 2 7 B DESC CO2 Ap E 4
How to Create a Package in Java? Explain with an example.
91 2 7 C DESC CO2 Ap M 12
Describe about different built in packages in Java
A. java.lang B. java.awt
C. java.lang.ref D. java.io
Answer is : B
93 2 8 A OBJ CO2 R E 1
The Date class includes within ………………….. package.
A. java.io B. java.awt
C. java.net D. java.util
Answer is : D
94 2 8 B DESC CO2 Ap M 4
Utilize the java.util package to implement a program that manages a contact list.
95 2 8 C DESC CO2 An M 12
Imagine you are building a library management system. Design a
and transactions and show the Java package which help in organizing
96 2 9 A OBJ Which of these keywords is used by a class to use an interface defined previously? CO2 R E 1
A. import B. Import
C. implements D. Implements
Answer is : C
97 2 9 A OBJ CO2 U M 1
Which of the following is a correct interface?
Answer is : D
98 2 9 A OBJ CO2 U M 1
Given the following piece of code:
voiddoYourJob();
{}
This code will not compile, because method doYourJob() This code will not compile, because class Dog must
A. B.
in interface Guard must be defined abstract implement method doYourJob() from interface Guard
This code will not compile, because in the declaration of
C. classDog we must use the keyword extends instead of D. This code will compile without any errors.
implements.
Answer is : D
99 2 9 A OBJ CO2 U E 1
Which of the following is true?
"X extends Y" is correct if and only if X is a class and Y is "X extends Y" is correct if and only if X is an interface
A. B.
an interface and Y is a class
"X extends Y" is correct if X and Y are either both classes "X extends Y" is correct for all combinations of X and Y
C. D.
or both interfaces being classes and/or interfaces
Answer is : C
100 2 9 B DESC CO2 An M 4
Develop a Java program to create an Animal interface with a method
called bark() that takes no arguments and returns void. Create a Dog
class that implements Animal and overrides speak() to print “Dog isbarking”;.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 10/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
Answer is : A
105 3 1 A OBJ Which of these keyword is not a part of exception handling? CO3 R E 1
A. Try B. Finally
C. Thrown D. Catch
Answer is : C
106 3 1 A OBJ CO3 R E 1
A method that potentially generates a checked exception must include this keyword in its method signature is ___
A. Throw B. Extend
C. Throws D. Extends
Answer is : C
107 3 1 A OBJ CO3 R E 1
In which of the following package exception class exits?
A. java.util B. java.file
C. java.net D. java.lang
Answer is : D
108 3 1 A OBJ CO3 U M 1
Choose the correct output of the following Java program.
class exception_handling
try
System.out.print("Hello"+" "+1/0);
catch(Arithmetic Exception e)
System.out.print("World");
A. Hello B. World
Answer is : B
109 3 1 B DESC CO3 U E 4
Examine the purpose of the finally clause of a try-catch-finally statement.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 11/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
Inner try blocks cannot have their own catch or finally Only one catch block is allowed for the entire nested try
A. B.
blocks. block structure.
A catch block can handle exceptions thrown by its
C. Finally blocks are not allowed in nested try statements. D. corresponding try block or any nested try blocks within
it.
Answer is : D
113 3 2 A OBJ CO3 U E 1
In a nested try-catch block, if the inner try block throws an exception and there is no corresponding catch block to handle
it, what will happen?
To catch any remaining exceptions not caught by catch To execute code that must run regardless of whether an
A. B.
blocks. exception was thrown or not.
C. To log exceptions for debugging purposes. D. To terminate the program if an exception occurs.
Answer is : B
115 3 2 B DESC CO3 An M 4
Compare the exception handling capabilities of a single try-catch block with a nested try-catch block in Java. When would
you use one over the other?
117 3 3 A OBJ Which of these exceptions handles the divide by zero error? CO3 R E 1
A. ArithmeticException B. MathException
C. IllegalAccessException D. IllegalException
Answer is : A
118 3 3 A OBJ Which of the following exceptions is a subclass of Runtime Exception? CO3 R E 1
A. IOException B. SQLException
C. ClassNotFoundException D. IllegalArgumentException
Answer is : D
119 3 3 A OBJ What type of exception is thrown when trying to access an array element with an invalid index? CO3 R E 1
A. IndexOutOfBoundsException B. ArrayStoreException
C. ArrayIndexOutOfBoundsException D. IllegalArgumentException
Answer is : C
120 3 3 A OBJ How do you define a user-defined exception in Java? CO3 R E 1
Answer is : A
121 3 3 B DESC CO3 U M 4
Can we throw an Unchecked Exception from a static block in java?
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 12/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
123 3 4 A OBJ Choose the best suitable type of multitasking. CO3 R E 1
Answer is : C
124 3 4 A OBJ CO3 U E 1
What is the name of the thread in the following Java Program?
Class multithreaded_programming
Thread t = Thread.currentThread();
System.out.println(t);
A. main B. Thread
Answer is : A
125 3 4 A OBJ Which of the following statements is true regarding the thread life cycle? CO3 U E 1
A thread enters the terminated state when it is waiting A thread enters the running state immediately after it is
A. B.
for input/output operations to complete. created.
A thread enters the waiting state when it is suspended A thread enters the blocked state when it is waiting for a
C. D.
by the operating system. lock to be released.
Answer is : B
126 3 4 A OBJ Which of the following is a correct constructor for thread? CO3 R E 1
Answer is : A
127 3 4 A OBJ CO3 U E 1
Which line of code will result in a compilation error due to a type mismatch?
C. Line 3 D. Line 4
Answer is : A
128 3 4 B DESC CO3 U E 4
Demonstrate the various stages of thread in thread life cycle.
131 3 5 A OBJ ___________function of pre-defined class Thread is used to check weather current thread being checked is still running. CO3 R E 1
A. isAlive() B. Join()
C. isRunning() D. Alive()
Answer is : A
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 13/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
132 3 5 A OBJ CO3 U E 1
Match the following.
A. 3,2,1,4 B. 2,1,3,4
C. 3,4,1,2 D. 4,2,3,1
Answer is : B
133 3 5 A OBJ Select the method which is used to begin the execution of a thread. CO3 R E 1
A. run() B. start()
C. runThread() D. startThread()
Answer is : B
134 3 5 B DESC CO3 U M 4
Interpret the implement of thread while using extending thread class or runnable interface and write their syntax.
Class multithreaded_programming
Thread t = Thread.currentThread();
System.out.println(t);
A. 4 B. 5
C. 0 D. 1
Answer is : B
138 3 6 A OBJ Which of this Thread class method is used to find out the priority given to a thread? CO3 R E 1
A. get() B. ThreadPriority()
C. getPriority() D. getThreadPriority()
Answer is : C
139 3 6 A OBJ What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY? CO3 R E 1
Answer is : C
140 3 6 A OBJ Thread priority in Java is represented in _____________. CO3 R E 1
A. Integer B. Float
C. Double D. Long
Answer is : A
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 14/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
141 3 6 A OBJ CO3 U E 1
Which line of code introduces a potential concurrency issue without proper synchronization?
1. int counter = 0;
3. counter++;
4. });
6. counter--;
7. });
8. thread1.start();
9. thread2.start();
A. Line 2 B. Line 3
Answer is : D
142 3 6 B DESC CO3 U M 4
Are there any best practices or guidelines for setting thread priorities in different types of applications, such as real-time
systems?
Answer is : A
149 3 7 A OBJ CO3 R E 1
After calling the wait() method the thread went to the waiting state, and which events occurs it will come out of this
waiting state?
Answer is : D
150 3 7 B DESC CO3 U E 4
Summarize about multithreading and give the methods for inter-thread communication.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 15/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
153 3 8 A OBJ CO3 U E 1
What will be the output of the following Java code?
Thread t = Thread.currentThread();
System.out.println(t);
A. Thread[5,main] B. Thread[main,5]
C. Thread[main,0] D. Thread[main,5,main]
Answer is : D
154 3 8 A OBJ CO3 U E 1
What is the output in the following Java program?
Classmultithreaded_programing
Publicstaticvoidmain(Stringargs[])
Thread t =Thread.currentThread();
System.out.println(t.isAlive());
A. 0 B. 1
C. true D. false
Answer is : C
155 3 8 A OBJ Which does not prevent JVM from terminating? CO3 R E 1
Answer is : B
156 3 8 B DESC CO3 R M 4
Discuss scenarios where daemon threads are commonly used and their advantages in those situations.
160 3 9 A OBJ Which of the following is a correct example of a wrapper class in Java? CO3 R E 1
A. Integer B. int
C. Char D. String
Answer is : A
161 3 9 A OBJ CO3 R E 1
Which method of the Integer class can be used to convert a string to an integer?
A. Integer.toInt() B. Integer.parseInt()
C. Integer.valueOf() D. Integer.parseInteger()
Answer is : B
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 16/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
162 3 9 A OBJ CO3 R E 1
What is unboxing in Java?
Converting a primitive type to its corresponding wrapper Converting a wrapper class object to its corresponding
A. B.
class object primitive type
Answer is : B
163 3 9 B DESC CO3 U M 4
Compare the usage of primitive types and their corresponding wrapper classes in Java. When might you prefer one over
the other?
A readLine() B nextLine()
C read() D getLine()
Answer is : B
166 4 1 A OBJ CO4 R E 1
_________class in Java is primarily used for writing text to the console.
A FileWriter B Console
C PrintWriter D BufferedWriter
Answer is : C
167 4 1 A OBJ CO4 R E 1
The standard output stream in Java is _________.
A System.err B System.out
C System.in D System.log
Answer is : B
168 4 1 A OBJ CO4 U M 1
Which of the following is used to handle errors in console I/O operations?
A IOException B ArrayIndexOutOfBoundsException
C FileNotFoundException D ClassNotFoundException
Answer is : A
169 4 1 B DESC CO4 U M 4
Discuss how you would read multiple lines of input from the console in Java. Provide code examples using both Scanner
and BufferedReader classes.
A FileOutputStream B FileReader
C BufferedWriter D PrintStream
Answer is : B
172 4 2 A OBJ CO4 U M 1
The purpose of the BufferedReader class is ______________.
A To buffer data for faster writing B To buffer data for faster reading
A writeString() B writeText()
C write() D output()
Answer is : C
174 4 2 A OBJ CO4 U M 1
Which of the following is NOT a method of File class?
A createNewFile() B delete()
C exists() D readFile()
Answer is : D
175 4 2 B DESC CO4 U M 4
Describe the process of reading from and writing to a text file in Java. Include a discussion on the FileReader and
FileWriter classes, and explain the importance of closing the file streams.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 17/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
178 4 3 A OBJ CO4 U M 1
Which of the following best describes generics in Java?
Mechanism for writing specific code for different data Mechanism for writing code that can handle different
A B
types types
A # B $
C <> D @
Answer is : C
180 4 3 A OBJ CO4 R E 1
Which of the following correctly defines a generic class?
A They cannot have non-generic methods. B They must have at least one generic method.
C They can be instantiated with any reference type. D They cannot be extended by non-generic classes.
Answer is : C
183 4 3 B DESC CO4 Ap M 4
Define generics in Java and explain their importance in reducing code duplication. How do generics contribute to type
safety in Java? Provide examples
A To allow a method to operate on objects of various types B To create multiple versions of a method
A A parameter that must be a class B A parameter that can only be of one type
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 18/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
194 4 6 A OBJ CO4 U M 1
Why can’t you create instances of type parameters in Java generics?
A StringBuilder B StringBuffer
C String D Array
Answer is : C
200 4 7 A OBJ CO4 U M 1
__________ method is used to concatenate two strings in Java.
A concat() B append()
C join() D combine()
Answer is : A
201 4 7 A OBJ CO4 R E 1
_________ class is used for mutable strings in Java.
A String B StringBuffer
C CharSequence D StringTokenizer
Answer is : B
202 4 7 A OBJ CO4 R E 1
___________method is used to find the length of a string.
A size() B getSize()
C length() D count()
Answer is : C
203 4 7 B DESC What are bounded type parameters in Java? Explain how they are used in generics with an example. Discuss the CO4 U E 4
advantages of using bounded types.
Answer is :
204 4 7 C DESC Create a Java application that includes several utility methods using generics, such as a method to swap two elements in CO4 An D 12
an array and a method to find the minimum and maximum elements in a collection. Explain how these generic methods
enhance code reusability and flexibility, and discuss how Java ensures type safety in such scenarios.
Answer is :
205 4 8 A OBJ CO4 R E 1
Which of the following is a valid method in the StringBuffer class?
A reverse() B delete()
A charAt() B extractChar()
C getChar() D substring()
Answer is : A
207 4 8 A OBJ CO4 U M 1
_________ method extracts a substring from a string.
A getSubString() B substring()
C subString() D extractString()
Answer is : B
208 4 8 B DESC List and explain at least three major limitations of Java generics. Provide examples that illustrate these limitations. How do CO4 U E 4
these limitations affect the way you design generic classes and methods?
Answer is :
209 4 8 C DESC Discuss the concept of bounded type parameters in Java generics. Explain how upper and lower bounds are used to CO4 Ap M 12
restrict the types that can be passed as arguments to generic methods and classes. Provide detailed code examples that
show the use of bounded types in real-world scenarios.
Answer is :
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 19/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
210 4 9 A OBJ CO4 U M 1
____________ method is used to compare two strings lexicographically.
A compareTo() B equals()
C compare() D matches()
Answer is : A
211 4 9 A OBJ CO4 R M 1
Which of the following methods compares two strings for content equality?
A compareTo() B equals()
C contentEquals() D ==
Answer is : A
212 4 9 A OBJ CO4 R E 1
__________method returns true if two strings are equal ignoring case.
A equals() B compareToIgnoreCase()
C equalsIgnoreCase() D contentEqualsIgnoreCase()
Answer is : C
213 4 9 B DESC CO4 U E 4
Compare and contrast the String, StringBuilder, and StringBuffer classes in Java. Discuss their thread safety, mutability,
and performance characteristics with examples
A B
C D
Answer is :
215 5 1 A OBJ CO5 An M 1
_______________class in JavaFX is the base class for all events?
A A) javafx.event.Event B B) javafx.event.EventBase
C C) javafx.event.EventSource D D) javafx.event.BaseEvent
Answer is : A
216 5 1 A OBJ CO5 Ap M 1
Which method is used to handle key events in JavaFX?
A A) setOnKeyPressed() B B) addKeyListener()
C C) setOnKeyReleased() D D) setOnKeyTyped()
Answer is : A
217 5 1 A OBJ CO5 R M 1
The event type is fired when the user clicks the mouse button?
A A) MouseEvent.MOUSE_CLICKED B B) MouseEvent.MOUSE_PRESSED
C C) MouseEvent.MOUSE_RELEASED D D) MouseEvent.MOUSE_ENTERED
Answer is : A
218 5 1 A OBJ CO5 R M 1
Which control is used to create a selectable checkbox in JavaFX?
A A) CheckBox B B) RadioButton
C C) ToggleButton D D) Button
Answer is : A
219 5 1 A OBJ CO5 U D 1
When using a ScrollPane in JavaFX, what happens if you set scrollPane.setPannable(false);?
A) Disables scrolling through content with the mouse B) Prevents panning of the content by clicking and
A B
wheel. dragging.
C C) Locks the scroll position to the top of the content. D D) Disables the scrollbar visibility.
Answer is : B
220 5 1 A OBJ CO5 Ap D 1
In JavaFX, how do you create a context menu that appears when the user right-clicks on a node?
A A) RadioButton B B) ListView
C C) ChoiceBox D D) ComboBox
Answer is : B
222 5 2 A OBJ CO5 U E 1
What does a ToggleButton represent in JavaFX?
A A) A button that toggles between two states B B) A button that opens a menu
A A) ChoiceBox B B) ComboBox
C C) ListView D D) ScrollPane
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 20/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
Answer is : C
224 5 2 A OBJ CO5 U M 1
The purpose of a ComboBox control _____________
A A) ChoiceBox B B) ListView
C C) ComboBox D D) TextArea
Answer is : A
226 5 2 A OBJ CO5 R E 1
Which layout arranges children in a horizontal row?
A A) VBox B B) FlowPane
C C) BorderPane D D) HBox
Answer is : D
227 5 2 A OBJ CO5 R E 1
The method used to set the style of a JavaFX control ____________
A A) setStyle() B B) applyStyle()
C C) setCss() D D) addStyle()
Answer is : A
228 5 2 B DESC Describe how you would handle mouse events in JavaFX. Provide a java code example that demonstrates handling both a CO5 U E 4
mouse click and a mouse hover event on a button.
229 5 2 B DESC Describe the purpose and usage of TextField and TextArea in JavaFX. How would you validate user input in these controls? CO5 R E 4
Provide example code.
230 5 2 C DESC Explain the lifecycle of a mouse event in JavaFX, from event triggering to event handling. Include descriptions of mouse CO5 Ap D 12
event types and how to differentiate between them in a JavaFX application.
231 5 3 A OBJ CO5 R E 1
The layout stack children on top of each other?
A A) GridPane B B) StackPane
C C) HBox D D) VBox
Answer is : B
232 5 3 A OBJ CO5 R E 1
What is the purpose of the setOnMouseEntered method in JavaFX?
C) To execute code when the mouse pointer enters the D) To change the style of the control when the mouse
C D
boundary of a control exits its boundary
Answer is : C
233 5 3 A OBJ CO5 U E 1
What does a ScrollPane control provide?
A A) TextField B B) TextArea
C C) Label D D) Button
Answer is : B
237 5 3 A OBJ CO5 R E 1
_____________ class represents a button in JavaFX?
A A) Button B B) PushButton
C C) ClickButton D D) ActionButton
Answer is : A
238 5 3 A OBJ CO5 U M 1
How do you change the text displayed on a Label?
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 21/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
241 5 3 B DESC How does the ListView control work in JavaFX? Describe how to populate a ListView with items and handle item selection CO5 U M 4
events. Include a sample code snippet.
242 5 3 B DESC Explain how the ScrollPane control functions in JavaFX. How would you use a ScrollPane to display content that is larger CO5 U E 4
than the viewable area? Provide a code example.
243 5 3 C DESC Compare and contrast the usage of CheckBox, RadioButton, and ToggleButton in JavaFX. Discuss scenarios where each CO5 An E 12
control type is most appropriate, and provide detailed examples of how to implement and manage these controls
programmatically.
244 5 3 C DESC Describe the functionalities and differences between ListView, ComboBox, and ChoiceBox in JavaFX. How would you CO5 E M 12
populate each control with data, handle user interactions, and customize their appearance? Provide code examples to
demonstrate these concepts.
245 5 3 C DESC Explain how to validate user input in JavaFX controls such as TextField and TextArea. Discuss different validation CO5 Ap M 12
techniques, including input restrictions, error handling, and user feedback mechanisms. Provide a comprehensive
implementation example.
246 5 4 A OBJ CO5 R D 1
What distinguishes a StackPane layout from other JavaFX layouts like HBox and VBox?
C) It stacks nodes directly on top of each other, D) It arranges nodes in distinct regions like top,
C D
allowing for overlays bottom, left, and right
Answer is : C
247 5 4 A OBJ CO5 R E 1
In a GridPane, which method sets the position of a node?
A A) add() B B) setPosition()
C C) setCell() D D) addNode()
Answer is : A
248 5 4 A OBJ CO5 R E 1
The layout ideal for creating a form with labeled field is _____________
A A) GridPane B B) HBox
C C) VBox D D) FlowPane
Answer is : A
249 5 4 A OBJ CO5 U M 1
What does VBox layout do in JavaFX?
A A) Menu B B) MenuBar
C C) MenuItem D D) MenuPane
Answer is : A
257 5 5 A OBJ CO5 R E 1
Which method is used to register an event handler for a JavaFX button?
A A) setOnClick() B B) addEventHandler()
C C) setOnAction() D D) handleEvent()
Answer is : C
258 5 5 A OBJ CO5 R E 1
Which of the following is a correct way to handle a mouse click event on a JavaFX Button?
A A) setOnAction() B B) setAction()
C C) setOnClick() D D) addActionListener()
Answer is : A
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 22/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank
261 5 5 B DESC Explain how to create a hierarchical menu structure using Menu and MenuItem in JavaFX. Provide an example where a CO5 An M 4
Menu contains sub-menus and items.
262 5 5 B DESC Describe the basic structure of a menu in JavaFX. How do you create a Menu, add MenuItem instances to it, and add this CO5 R D 4
Menu to a MenuBar? Include a java code example.
263 5 5 B DESC How would you handle action events for MenuItem instances in JavaFX? Provide an example of how to set up event CO5 An M 4
handling for menu actions.
264 5 5 C DESC Explain the structure and hierarchy of menus in JavaFX, including Menu, MenuBar, and MenuItem. How do you create a CO5 An E 12
multi-level menu system with sub-menus and handle user interactions using event handling? Provide detailed code
examples to illustrate the implementation of a hierarchical menu structure.
172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 23/23