CBSE-CLASS-XII SERIES Information-technology
Programming In Java
17 previous year questions.
Volume: 17 Ques
Yield: Medium
High-Yield Trend
17
2025 Chapter Questions 17 MCQs
01
PYQ 2025
medium
information-technology ID: cbse-cla
Write a Java program to calculate and display the factorial of a number 5 using for loop.
02
PYQ 2025
medium
information-technology ID: cbse-cla
With reference to Java programming language, define assertion. State any one way to write an assertion.
03
PYQ 2025
medium
information-technology ID: cbse-cla
Differentiate between Entry controlled loop and Exit controlled loop.
04
PYQ 2025
medium
information-technology ID: cbse-cla
Consider the following string variables:
String str1 = "Hello";
String str2 = "Java Programming";
Write the code statements for the following in Java: (a) To display the string str1 into upper case.
(b) To display the character at the index 6 in string str2.
(c) To display the index of the first occurrence of letter βlβ in the string str1.
(d) To display the string str1 after replacing letter βlβ with β*β.
String str1 = "Hello";
String str2 = "Java Programming";
Write the code statements for the following in Java: (a) To display the string str1 into upper case.
(b) To display the character at the index 6 in string str2.
(c) To display the index of the first occurrence of letter βlβ in the string str1.
(d) To display the string str1 after replacing letter βlβ with β*β.
05
PYQ 2025
medium
information-technology ID: cbse-cla
What is Java IDE? Name any one commonly used Java IDE.
06
PYQ 2025
medium
information-technology ID: cbse-cla
What will be the output of the following Java statements:
(a) System.out.println ("30 + 20");
(b) System.out.println ("Information Technology" + 802);
(a) System.out.println ("30 + 20");
(b) System.out.println ("Information Technology" + 802);
07
PYQ 2025
medium
information-technology ID: cbse-cla
In Java, ................ statement is used to execute a block of code matching one value out of many possible values.
1
if
2
for
3
while
4
switch
08
PYQ 2025
medium
information-technology ID: cbse-cla
In which Java package is the scanner class available?
1
java.util
2
java.applet
3
java.net
4
java.lang
09
PYQ 2025
medium
information-technology ID: cbse-cla
A/An ................ in Java is a block of statements grouped together to perform a specific task.
1
Array
2
Object
3
Class
4
Method
10
PYQ 2025
medium
information-technology ID: cbse-cla
Name the Java interpreter that translates the byte code into machine code and then executes it.
11
PYQ 2025
medium
information-technology ID: cbse-cla
Which access modifier in Java is used to make a data member or a method member of a class visible only within the class?
1
public
2
protected
3
default
4
private
12
PYQ 2025
medium
information-technology ID: cbse-cla
Exception thrown by any statement in try block in a Java program is handled in ................ block.
1
final
2
throw
3
catch
4
except
13
PYQ 2025
medium
information-technology ID: cbse-cla
Which is the correct way to write multiline comments in a Java program?
1
Beginning a comment line with two consecutive forward slashes (//).
2
Writing a comment between the symbols /* and */.
3
Beginning a comment line with # symbol.
4
Writing the comment between the symbols /# and #/.
14
PYQ 2025
medium
information-technology ID: cbse-cla
Select the valid statement to declare and initialize an array in Java:
1
int[] marks;
2
int[] marks = 60, 70, 90;
3
int[] marks = (60, 70, 90);
4
int[] marks = [60, 70, 90];
15
PYQ 2025
medium
information-technology ID: cbse-cla
What is a variable in Java programming language?
16
PYQ 2025
medium
information-technology ID: cbse-cla
"Variables in Java need not be declared and initialized before they are used." State True or False.
17
PYQ 2025
medium
information-technology ID: cbse-cla
All Java statements must end with a/an ................ .
