0% found this document useful (0 votes)
20 views

PDF&Rendition 1

Uploaded by

aar55721
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

PDF&Rendition 1

Uploaded by

aar55721
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank

S.NO UNIT CHAP. PART Q.TYPE QUESTION CO KL QL MARK

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

C. Class D. None of these

Answer is : A
3 1 1 A OBJ CO1 R E 1
_________represents the data (value) of an object.

A. State B. Behavior

C. Identity D. All of the above

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

C. Abstraction D. All of the above

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 ?

A. child Class-based language B. Class-based language

C. Object-based language D. Procedure oriented language

Answer is : C
14 1 3 A OBJ CO1 U M 1
Find the output of the following program

public class Solution

public static void main(String[] args)

short x = 10;

x = x * 5;

System.out.print(x);

A. 50 B. 10

C. Compile error D. Exception

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

To call the main method outside of Class or Package by


A. To hide the main method from misuse B.
JV

C. To protect main method D. None of the above

Answer is : B
23 1 5 A OBJ CO1 R E 1
Every statement in Java language should end with a____

A. Dot or Period B. Comma

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_____

A. File B. Class or Interface

C. static method D. main

Answer is : B
25 1 5 A OBJ CO1 R E 1
________ is the need to mention "static" before main method.

To make main method as class method common to all


A. To call main method without creating an object of class B.
instance

C. Both A and B D. None of the above

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;

char String = ‘I’;

System.out.print(Integer);

System.out.print(String);

A. Compile error B. Throws exception

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

public class Solution

public static void main(String[] args)

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.

A. char[] ch = new char(5) B. char[] ch = new char[5]

C. char[] ch = new char() D. char[] ch = new char[]

Answer is : B
35 1 7 A OBJ Select the valid statement to declare and initialize an array. CO1 R M 1

A. int[] A = {} B. int[] A = {1, 2, 3}

C. int[] A = (1, 2, 3) D. int[][] A = {1, 2, 3}

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

* operator has converted b * 50 into int, which cannot


C. No error in this code D.
beconverted to byte without casting
Answer is : D
37 1 7 B DESC CO1 U E 4
Construct a simple program for following data types
a) Boolean

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?

A. public member B. private member

C. protected member D. static member

Answer is : B
40 1 8 A OBJ CO1 Ap M 1
What will be the output of the following Java code?

class San{

public void m1 (int i,float f)

System.out.println(" int float method");

public void m1(float f,int i);

System.out.println("float int method");

public static void main(String[]args)

San s=new San();

s.m1(20,20);

A. int float method B. float int method

C. compile time error D. run time error

Answer is : C
41 1 8 A OBJ __________is the biggest reason for the use of Polymorphism. CO1 Ap M 1

It allows the programmer to think at a more abstract


A. B. There is less program code to write
level
The program will have a more elegant design and will
C. D. Program code takes up less space
beeasier to maintain and update
Answer is : C
42 1 8 B DESC CO1 Ap E 4
Create a class with a static initialization block that prints a message when the class is loaded. Observe when and how
many times this block is executed.

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.

45 1 9 A OBJ Why do we use constructor overloading? CO1 R E 1

A. To use different types of constructors B. Because it’s a feature provided

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?

51 2 1 A OBJ Which of these can be overloaded? CO2 R E 1

Methods Constructors
A. B.

All of the mentioned


C. D. None of the mentioned

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

C. It depends on the Java version being used D. None of the above

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?

A. The compiler throws an error B. The methods are considered overloaded

The second method is considered overriding the first


C. D. The methods cannot have the same name
method
Answer is : A
54 2 1 A OBJ Non-static nested classes have access to _____________ from enclosing class. CO2 R E 1

Private members Protected members


A. B.

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.

57 2 2 A OBJ Use of nested class ____________ encapsulation. CO2 R E 1

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?

Class inside a class


A. B. Class inside a function

C. Class inside a package D. Class inside a structure

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?

A. class B:A{} B. class B extends A{}

C. class B extends class A{} D. class B implements A{}

Answer is : B
62 2 3 A OBJ CO2 R E 1
Which class cannot be sub classed?

A. final class B. object class

C. abstract class D. child class

Answer is : A
63 2 3 A OBJ CO2 R E 1
Order of execution of constructors in Java Inheritance is

A. Base to derived class B. Derived to base class

C. Random order D. None of the above

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

I. Extending two or more classes.

II. Extending one class and implementing one or more interfaces.

III. Implementing two or more interfaces.

A. Only II B. I and II

C. II and III D. Only I

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

C. To create a new instance of a class D. To define a static method

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

A class extends another class which also extends


C. D. All of the above
another class
Answer is : C
69 2 4 B DESC CO2 An M 4
Can we achieve multiple inheritance in Java? Explain with example

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.

71 2 5 A OBJ Which of these is supported by method overriding in Java? CO2 R E 1

A. Abstraction B. Encapsulation

C. Polymorphism D. None of the mentioned

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?

A. An abstract class can be extended B. A subclass of a non-abstract superclass can be abstract

A subclass can override a concrete method in a


C. D. All of the above
superclass to declare it abstract
Answer is : D
75 2 5 B DESC CO2 Ap E 4
What are the super () and this () methods in Java?

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?

A. class A { abstract void unfinished() { } } B. class A { abstract void unfinished(); }

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?

1. A a = new A();2. A a = new B();3. B b = new A();4. B b = new B();

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

A. final class cannot be inherited B. final method can be inherited

C. final method can be overridden D. Final variable of a class cannot be changed.

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

C. Interfaces D. None of the Mentioned.

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

87 2 7 A OBJ The correct way of importing an entire package ‘pkg’? CO2 R M 1

A. import pkg. B. Import pkg.

C. import pkg.* D. Import pkg.*

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

Which of the following is a predefined package in Java?

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

92 2 8 A OBJ Package is used for GUI? CO2 R E 1

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

package structure that includes modules for managing books, patrons,

and transactions and show the Java package which help in organizing

and maintaining this system.

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?

A. interface A { void print() { } } B. abstract interface A { print(); }

C. abstract interface A { abstract void print(); { }} D. interface A { void print(); }

Answer is : D
98 2 9 A OBJ CO2 U M 1
Given the following piece of code:

public interface Guard

voiddoYourJob();

abstract public class Dog implements Guard

{}

Which of the following statements is correct?

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

101 2 9 B DESC CO2 Ap E 4


Describe the uses of interfaces in Java

102 2 9 C DESC CO2 Ap E 12


Describe with an example how an interface is implemented.

103 2 9 C DESC CO2 An M 12


Write a Java programming to create a banking system with three classes - Bank, Account, SavingsAccount, and
CurrentAccount. The bank should have a list of accounts and methods for adding them. Accounts should be an interface
with methods to deposit, withdraw, calculate interest, and view balances. SavingsAccount and CurrentAccount should
implement the Account interface and have their own unique methods.

104 3 1 A OBJ CO3 R E 1


When does Exception in Java arise in code sequence?

A. Run time B. Compilation time


C. Can occur any time D. None of the above

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

Public static void main(String args[])

try

System.out.print("Hello"+" "+1/0);

catch(Arithmetic Exception e)

System.out.print("World");

A. Hello B. World

C. Hello World D. Compilation Error

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.

110 3 1 B DESC CO3 An M 4


Is it necessary that each try block must be followed by a catch block? Give your answer with example.

172.16.102.251/apps/examportal/admin/PrintQuestions.php?q=MjAyM3x8VUcwOHx8MjMxQ1MzMjM= 11/23
9/20/24, 12:30 PM 2023_UG08_231CS323_Question Bank

111 3 1 C DESC CO3 Ap M 12


Evaluate a try block that is likely to generate three types of exception and then incorporate necessary catch blocks and
handle them appropriately

112 3 2 A OBJ CO3 R M 1


Which of the following is true about nested try statements in Java?

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?

The exception is propagated to the outer catch block, if


A. B. The program terminates immediately.
available.
The exception is ignored, and execution continues from The exception is handled by the JVM and the program
C. D.
the finally block. continues.
Answer is : A
114 3 2 A OBJ CO3 U E 1
What is the purpose of a finally block in nested try-catch statements?

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?

116 3 2 C DESC CO3 Ap M 12


Write a Java method that reads data from a list of files, processes each line of data, and handles exceptions using nested
try-catch blocks. Ensure that the method can handle file-related exceptions and data processing exceptions appropriately.
Explain how the nested try-catch blocks help in managing these exceptions.

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

A. By extending the Exception class B. By extending the Error class

C. By implementing the Throwable interface D. By implementing the Exception interfaceOption4

Answer is : A
121 3 3 B DESC CO3 U M 4
Can we throw an Unchecked Exception from a static block in java?

122 3 3 C DESC CO3 Ap M 12


Implement a Program to throw user defined exception if the given number is not positive.

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

A. Process based B. Thread based

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

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

Public static void main(Stringargs[])

Thread t = Thread.currentThread();

System.out.println(t);

A. main B. Thread

C. System D. None of the above

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

A. Thread(Runnable a, String str) B. Thread(int priority)

C. Thread(Runnable a, int priority) D. Thread(Runnable a, ThreadGroup t)

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?

1. Thread thread = new Thread();

2. int result = thread.start();

3. Object obj = new String("Hello");

4. String str = obj;

A. Line 1 B. No compilation error

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.

129 3 4 B DESC CO3 R E 4


Mention some of the methods are used in thread class.

130 3 4 C DESC CO3 Ap M 12


How can implement a Thread? Write Java programs to create the thread using the two methods to implement it. Use two
threads and fetch the names of the thread for implement it.

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.

isAlive()-Entry point for the thread.

run() - determine if thread is still running

sleep() - Suspend a thread for a period of time.

start() - Start a thread by calling its run method.

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.

135 3 5 C DESC CO3 Ap M 12


Develope a Java program to use of join (), wait (), notify (), and notifyall () associated with multithreaded programming.

136 3 5 C DESC CO3 Ap M 12


Create a thread and explore all built-in methods available for threads.

137 3 6 A OBJ CO3 R E 1


What is the priority of the thread in the following Java Program?

Class multithreaded_programming

Public static void main(Stringargs[])

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

A. 0 & 256 B. 0 & 1

C. 1 & 10 D. 1 & 256

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;

2. Thread thread1 = new Thread(() -> {

3. counter++;

4. });

5. Thread thread2 = new Thread(() -> {

6. counter--;

7. });

8. thread1.start();

9. thread2.start();

A. Line 2 B. Line 3

C. Line 6 D. No potential concurrency issue

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?

143 3 6 B DESC CO3 U M 4


Differentiate between wait and sleep. Can a constructor be synchronized?

144 3 6 B DESC CO3 U M 4


Should we interrupt a thread? Tell about the purpose of the Synchronized block.

145 3 6 B DESC CO3 Ap M 4


If you have a Java program utilized two threads are A and B. Thread A perform a critical task itrequire immediate
attention, but thread B perform a non-critical task it can be delayed if necessary. How can you assign thread priorities in
Java to ensure Thread A gets higher priority than Thread B? Write a program for this condition.

146 3 6 C DESC CO3 Ap M 12


Write a program to create three threads and the process of synchronization in detail with suitable example.

147 3 6 C DESC CO3 Ap M 12


Implement a Java application that shows how the transactions in a bank can be carried out concurrently.

148 3 7 A OBJ CO3 R E 1


_________ Mechanism is used when a thread is paused running in its critical section and another thread is allowed to
enter (or lock) in the same critical section to be executed.

A. Inter-thread communication B. Initial-thread communication

C. Mutual Exclusive D. None of the above

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?

A. If the waiting thread got a notification B. If time expires.

C. If the waiting thread got interrupted. D. All of the above

Answer is : D
150 3 7 B DESC CO3 U E 4
Summarize about multithreading and give the methods for inter-thread communication.

151 3 7 B DESC CO3 U M 4


Provide an example of inter-thread communication using either wait() and notify() or locks and conditions.

152 3 7 C DESC CO3 Ap M 12


Write a Java program which handles Push operation and Pop operation on stack concurrently

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?

Class multithreaded programing

public static void main(String args[])

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

A. Process B. Daemon Thread

C. User Thread D. JVM Thread

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.

157 3 8 B DESC CO3 U M 4


How can you ensure all threads that started from main must end in order in which they started and also main should end
in last?

158 3 8 B DESC CO3 U M 4


Differentiate notify () and notify All (). Recall the similarity between yield() and sleep().

159 3 8 C DESC CO3 Ap M 12


Develope a Java application for the list of numbers and then sort in ascending order as well as in descending order
simultaneously.

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

C. Automatically handling exceptions D. Automatically converting strings to numbers

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?

164 3 9 C DESC CO3 Ap M 12


Develope a Java program to demonstrate the concept of autoboxing and unboxing with an ArrayList of Integer type.
Explain how the process works internally.

165 4 1 A OBJ CO4 R E 1


__________method is used to read a line of text from the console in Java.

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.

170 4 1 C DESC CO4 Ap M 12


Create a class called student. write a student manager program to manipulate the student information from files by using
the bufferedreader and buffered writer.

171 4 2 A OBJ CO4 R E 1


______________ class is used to read from a file in Java.

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

C To read binary data D To write data to a buffer


Answer is : B
173 4 2 A OBJ CO4 R E 1
___________ method is used to write a string to a file.

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.

176 4 2 B DESC CO4 Ap M 4


Explain how BufferedReader and BufferedWriter can improve file I/O performance in Java. Provide code examples to
demonstrate their usage.

177 4 2 C DESC CO4 An D 12


Write a comprehensive program in Java that demonstrates reading data from a text file, processing the data, and then
writing the processed data to another file. In your explanation, discuss the use of FileReader, FileWriter, BufferedReader,
and BufferedWriter. Explain how exception handling is managed when working with file I/O in Java.

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

Mechanism for writing code that handles multiple


C D Mechanism for writing polymorphic code
exceptions
Answer is : B
179 4 3 A OBJ CO4 R E 1
The symbol which is used to define a generic type in Java is _____.

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 class GenericClass<> {} B class GenericClass {}

C class GenericClass {T} D class GenericClass {}


Answer is : B
181 4 3 A OBJ CO4 U M 1
In a generic class, what does represent?

A A method B A type parameter

C A package D An instance variable


Answer is : B
182 4 3 A OBJ CO4 U M 1
Which of the following is true about generic classes?

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

184 4 3 C DESC CO4 Ap M 12


Explain the concept of file handling in Java, focusing on both binary and text files. Discuss the differences between byte
streams (FileInputStream and FileOutputStream) and character streams (FileReader and FileWriter). Provide examples to
show when you would use each type of stream and how they can be combined with buffering to improve performance.

185 4 4 A OBJ CO4 R E 1


The purpose of a generic method is ____________

A To allow a method to operate on objects of various types B To create multiple versions of a method

C To allow overloading of methods D To restrict a method to a specific type


Answer is : A
186 4 4 A OBJ CO4 R E 1
Which of the following correctly defines a generic method?

A public void methodName(T t) {} B public void methodName(T t) {}

C public void methodName() {} D public void methodName() {}


Answer is : A
187 4 4 B DESC Illustrate the concept of bounded types in generic programming and their purpose. CO4 U E 4
Answer is :
188 4 5 A OBJ CO4 R E 1
What is a bounded type parameter?

A A parameter that must be a class B A parameter that can only be of one type

C A parameter restricted to a subtype of a specific class D A parameter restricted to primitive types


Answer is : C
189 4 5 A OBJ CO4 U M 1
Which of the following correctly bounds a type parameter to Number?

A <T extends Number> B <T Super Number>

C <T is Number> D <T of Number>


Answer is : A
190 4 5 B DESC CO4 Ap D 4
Create a simple generic class in Java that can hold two objects of different types. Explain how this class can be
instantiated and used with different data types.

191 4 5 B DESC CO4 U M 4


Explain how inheritance works with generic classes in Java. Provide an example where a generic class is extended by
another class. Discuss the rules that apply when creating such a subclass.

192 4 5 C DESC CO4 Ap M 12


Explore the concept of generic programming in Java by discussing how it addresses issues related to code reuse and type
safety. Provide a detailed example of a generic class and a generic method, and explain how generics allow the same code
to operate on different types while preventing runtime type errors. Include a discussion on the limitations of generics due
to type erasure.

193 4 6 A OBJ CO4 R E 1


__________ is NOT allowed in Java generics.

A Creating arrays of parameterized types B Using wildcards

C Subclassing generic classes D Creating instances of type parameters


Answer is : D

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 Type parameters are erased at runtime B Type parameters are abstract

C Type parameters are final D Type parameters are interfaces


Answer is : A
195 4 6 A OBJ CO4 R E 1
__________ exceptions can be thrown using generic types.

A Checked exceptions B Unchecked exceptions

C Runtime exceptions D No exceptions can be generic


Answer is : D
196 4 6 B DESC CO4 Ap D 4
Write a generic method that takes an array of any type and returns the maximum element in that array. Explain the
method's implementation and discuss how type safety is maintained.

197 4 6 B DESC CO4 U M 4


Discuss how generic methods can be used to implement utility functions that operate on different types. Provide an
example where a generic method processes a list of objects.

198 4 6 C DESC CO4 Ap M 12


Design a Java class that implements a generic stack data structure. Your implementation should include methods to push,
pop, and peek elements, as well as checking if the stack is empty. Discuss how generics allow the stack to work with any
type of object. Explain the benefits and any potential drawbacks of using a generic stack over a non-generic
implementation.

199 4 7 A OBJ CO4 R E 1


Which of the following is immutable in Java?

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()

C replace() D All of the above


Answer is : D
206 4 8 A OBJ CO4 U M 1
________ method extracts a single character from a string.

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

214 4 9 C OBJ CO4 R E 12


i) Give Restrictions and limitations of bounded types. ii) Outline bounded types with an example.

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) Use ContextMenu class with


A B B) Use PopupMenu class with setOnMouseRightClick().
setOnContextMenuRequested()

D) Use PopupMenu class with


C C) Use ContextMenu class with setOnMouseClicked() D
setOnContextMenuRequested()
Answer is : A
221 5 1 A OBJ CO5 U M 1
Which control in JavaFX is typically used for allowing the user to select multiple options from a list?

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

C C) A button that submits a form D D) A button that clears a text field


Answer is : A
223 5 2 A OBJ CO5 R E 1
Which control is used to display a list of items from which a user can select?

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) To display a drop-down list of items B B) To display a fixed set of radio buttons

C C) To create a group of checkboxes D D) To display a scrollable list


Answer is : A
225 5 2 A OBJ CO5 U M 1
Which control provides a scrollable list of options where a single item can be chosen?

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?

A A) To handle mouse drag events B B) To handle mouse clicks

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) A way to scroll through content B B) A way to switch between tabs

C C) A way to resize controls D D) A way to handle user input


Answer is : A
234 5 3 A OBJ CO5 Ap M 1
How do you add content to a ScrollPane?

A A) Using setContent() B B) Using addContent()

C C) Using getChildren().add() D D) Using add()


Answer is : A
235 5 3 A OBJ CO5 U D 1
The purpose of TextField in JavaFX _____________

A A) To display a single-line text input B B) To display multiple lines of text

C C) To create a text area with scrolling D D) To display a label


Answer is : A
236 5 3 A OBJ CO5 R E 1
Which control allows for displaying and editing multiple lines of text?

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?

A A) Using setText() B B) Using changeText()

C C) Using updateText() D D) Using setLabel()


Answer is : A
239 5 3 B DESC Discuss the functionality of ToggleButton and RadioButton in JavaFX. How can ToggleButton be used to toggle between two CO5 U M 4
states, and how does RadioButton fit into a group of mutually exclusive options? Provide code examples.
240 5 3 B DESC What is the difference between ComboBox and ChoiceBox in JavaFX? Provide examples of scenarios where each would be CO5 R E 4
appropriately used. Include code samples to illustrate.

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?

A) It allows for precise positioning of nodes within a


A B B) It arranges nodes in a horizontal or vertical line
grid.

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) Arranges children horizontally B B) Arranges children vertically

C C) Arranges children in a grid D D) Stacks children on top of each other


Answer is : B
250 5 4 B DESC Explain how the HBox layout arranges its children. What are some practical scenarios where an HBox is preferred over CO5 An M 4
other layouts? Provide a code example.
251 5 4 B DESC Describe the BorderPane layout in JavaFX. What are its five regions, and how would you add nodes to these regions? CO5 U M 4
Include a sample code snippet.
252 5 4 B DESC How does the StackPane layout work? Discuss its use cases and provide an example of how to overlay multiple nodes CO5 R M 4
using StackPane.
253 5 4 C DESC Explain the concept of constraints in the GridPane layout of JavaFX. How do you define and apply row and column CO5 Ap E 12
constraints to manage layout alignment and spacing? Provide a step-by-step example demonstrating the use of constraints
to organize UI elements within a GridPane.
254 5 4 C DESC Discuss the nesting of layouts in JavaFX. Provide a comprehensive example where you combine multiple layout types (e.g., CO5 An M 12
BorderPane with nested VBox and GridPane) to create a complex user interface. Explain the rationale behind your layout
decisions and how each nested layout contributes to the overall design.
255 5 4 C DESC Compare and contrast the HBox, VBox, BorderPane, StackPane, GridPane, and FlowPane layouts in JavaFX. For each CO5 Ap E 12
layout, discuss their primary use cases, advantages, and scenarios where they would be preferred over other layouts.
Provide detailed examples of implementing each layout type in a practical application.
256 5 5 A OBJ CO5 U E 1
Which class is used to create a menu 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) button.setOnMouseClicked(e -> { /* B) button.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> { /*


A B
code */ }); code */ });

C) button.setOnAction(e -> { /* code */


C D D) Both A and B
});
Answer is : D
259 5 5 A OBJ CO5 R M 1
How do you add a MenuItem to a Menu?

A A) Using getItems().add() B B) Using addMenuItem()

C C) Using add() D D) Using addChild()


Answer is : A
260 5 5 A OBJ CO5 U M 1
The method is used to set the action for a MenuItem _____________

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

You might also like