MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Computer Science
Java
Quiz 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Q.1
Which of these is not a Thread state?
New
Runnable
sleep
terminated
Q.2
Which of the following is incorrect?
int count = 50.0;
int salary = 50_000;
int salary = 50_00;
all of these are incorrect
Q.3
What is modulo operation used for ?
performs division
performs division and gives no remainder
performs division and gives remainder
does not perform division
Q.4
Is String a primitive data type?
Yes
No
Both
Q.5
Which of the following for loop declaration is not valid?
for ( int i = 99; i >= 0; i / 9 )
for ( int i = 7; i <= 77; i += 7 )
for ( int i = 20; i >= 2; - -i )
for ( int i = 2; i <= 20; i = 2* i )
Q.6
What does the expression float a =/ 0 return?
0
Not a number
Infinity
Run time exception
Q.7
Class Cat extends Animal. Which is NOT a valid declaration?
Cat x = new Cat();
Animal X = new Animal();
Cat x = new Animal();
Animal x = new Cat();
Q.8
The following Syntax is used for?class Subclass-name extends Superclass-name { //methods and fields }
Polymorphism
Encapsulation
Inheritance
None of the above
Q.9
Does a programmer always know how long an array will be when the program is being written?
Yes---the program will not compile without the length being declared.
No---the array object is created when the program is running, and the length might change from run to run.
Yes---otherwise the program will not run correctly.
No---arrays can grow to whatever length is needed.
Q.10
String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";What is the correct way to find the length of "txt" string?
int len = length(txt);
float len = txt.length();
int len = txt.length();
double len = length(txt);
Q.11
Create an array ofstrings called months.
String[] months = new String[12];
String months = new String[12];
String[] months = new String[];
String[12] months = new String[];
Q.12
Synchronized static methods acquire lock on
Class
Object
Interface
None
Q.13
Which of the following option leads to the portability and security of Java?
Bytecode is executed by JVM
The applet makes the Java code secure and portable
Use of exception handling
Dynamic binding between objects
Q.14
Int [] nums = {11};How would you access the fourth element in nums?
nums[4]
nums[3]
nums(4)
nums(3)
Q.15
What will the following program segment display?for(int a =a <=a += 3)System.out.print(a+””);
2 5 8
2 5
2 5 8 11
2
Q.16
What is the length of the following array: byte[] data = {-};
1
5
6
12
Q.17
Which method is used to get current running thread object?
runningThread()
currentThread()
runnableThread()
None
Q.18
Which of the following concepts of OOPS means exposing only necessary information to client?
Encapsulation
Abstraction
Data hiding
Data binding
Q.19
What is use of interpreter?
They convert bytecode to machine language code
They read high level code and execute them
They are intermediated between JIT and JVM
It is a synonym for JIT
Q.20
Which method is called internally by Thread start() method?
execute()
run()
launch()
main()
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