MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Computer Science
Core Java
Quiz 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Q.1
Command to run a Java program
javaa
java
jaava
jaavaa
Q.2
What will be the output of the following Java program?class mainclass {public static void main(String args[]){char a = 'A';a++;System.out.print((int)a);}}
66
67
65
64
Q.3
What will be the output of the following Java program?class array_output { public static void main(String args[]) { char array_variable [] = new char[10]; for (int i =i <++i) { array_variable[i] = 'i'; System.out.print(array_variable[i] + "" ); i++; } } }
i i i i i
0 1 2 3 4
i j k l m
None of the mentioned
Q.4
Command to compile Java program
javax
javay
javac
Java
Q.5
A ___________ file is created after successful compilation of a Java program.
Object file
Array file
Class file
String file
Q.6
Which one is a valid declaration of a boolean?
boolean b1 = 1;
boolean b2 = ‘false’;
boolean b3 = false;
boolean b4 = ‘true’
Q.7
Java program is
Interpreted
Compiled
Q.8
Which of these values can a boolean variable contain?
True & False
0 & 1
Any integer value
true
Q.9
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
Q.10
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
Q.11
Which provides runtime environment for java byte code to be executed?
JDK
JVM
JRE
JAVAC
Q.12
Java language was initially called as ________
Sumatra
J++
Oak
Pine
Q.13
Data type long literals are appended by _____
Uppercase L
Lowercase L
Long
Both Uppercase L & Lowercase L
Q.14
Command to execute compiled java program is
java
javac
run
javaw
Q.15
String s1 = new String("java");String s2 = new String("JAVA");System.out.println(s1 = s2);
JAVA
java
true
false
Q.16
The command javac
Converts a java program into binary code
Converts a java program into bytecode
Converts a java program into machine language
None of the above.
Q.17
Which of the following are not Java keywords ?
double
switch
then
instanceof
Q.18
String s = "Java"+1+2+"Quiz"+""+(3+4);System.out.println(s);
Java3Quiz7
Java12Quiz7
Java12Quiz34
Java3Quiz34
Q.19
String s1 = "abc";String s2 = "def";System.out.println(s1.compareTo(s2));
0
true
-3
false
Q.20
String s = "Java String Quiz";System.out.println(s.substring(5,3));
Prints “Str”
Runtime Exception
IndexOutOfBoundsException Runtime Exception
StringIndexOutOfBoundsException Compile-time error
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page