Core Java- Basics Quiz- 4
Question 1: Primitive datatypes are allocated on a stack.
a) True
b) False
Answer: a
Question 2: Following code will result in: int a1 = 5; double a2 = (float)a1;
a) Compilation error
b) Runtime error
c) No errors
d) Runtime Exception
Answer: c
Question 3: Java runs on _______.
a) Windows
b) Unix/Linux
c) Mac
d) All of the above
Answer: d
More Core Java Online Speed Test: [Link] Page 1
Question 4: Which is NOT a section of all types of loops ?
a) Initialization
b) Loop Body
c) Test statement
d) The word "while"
Answer: d
Question 5: What is the size of a Char in Java?
a) 4 bits
b) 7 bits
c) 8 bits
d) 16 bits
Answer: d
Question 6: What is the default value of the local variables?
a) null
b) 0
c) depends on the data type
d) no default value for local variables
Answer: d
More Core Java Online Speed Test: [Link] Page 2
Question 7: In a "for" loop, what section of the loop is not included in the parentheses after "for" ?
a) Initialization
b) Loop Body
c) Test statement
d) Update
Answer: b
Question 8: What is essential in making sure that your loop is not infinite ?
a) That your Boolean statement will at some point be false
b) That there is a Boolean statement somewhere in your code
c) That your Boolean statement will at some point be true
d) All of the choices
Answer: d
Question 9: What is a loop?
a) A new type of Applet.
b) A segment of code to be run a specified amount of times
c) A segment of code to be run infinite times
d) A segment of code to be run once
Answer: b
More Core Java Online Speed Test: [Link] Page 3
Question 10: What displays from the following statements? String word = "abcde"; for (int i = 0; i <4;
i+=2) [Link](word[i]);
a) ab
b) ac
c) ace
d) bd
Answer: b
Question 11: A null reference may be used to access a static variable or method.
a) True
b) False
Answer: a
Question 12: Is Empty .java file name a valid source file name?
a) Yes
b) No
Answer: a
Question 13: Which one is not correct??
a) A class needs to be instantiated as an object before being used
b) An objects exists in memory in run time
c) Class and object are just different names for the same thing
d) An object is a variable, where its type is the class used to declare the variable
Answer: c
More Core Java Online Speed Test: [Link] Page 4
Question 14: Following code will result in: int num = 6.7;
a) Compilation error
b) Runtime error
c) num being 6.7
d) num being 6
Answer: a
Question 15: Can you compare a boolean to an integer?
a) Yes
b) No
Answer: b
For Latest Released Quizzes/Online Speed Tests: [Link]
For Various Quizzes/Online Speed Tests: [Link]
More Core Java Online Speed Test: [Link] Page 5