MCQ Mojo
access_time
menu
Quiz
Web Stories
CBSE
arrow_drop_down
MCQ Questions for CBSE Class 12 with Answers
MCQ Questions for CBSE Class 11 with Answers
MCQ Questions for CBSE Class 10 with Answers
MCQ Questions for CBSE Class 9 with Answers
MCQ Questions for CBSE Class 8 with Answers
MCQ Questions for CBSE Class 7 with Answers
MCQ Questions for CBSE Class 6 with Answers
MCQ Questions for CBSE Class 5 with Answers
MCQ Questions for CBSE Class 4 with Answers
MCQ Questions for CBSE Class 3 with Answers
MCQ Questions for CBSE Class 2 with Answers
MCQ Questions for CBSE Class 1 with Answers
CBSE
arrow_drop_down
MCQ Questions for CBSE Class 12 with Answers
MCQ Questions for CBSE Class 11 with Answers
MCQ Questions for CBSE Class 10 with Answers
MCQ Questions for CBSE Class 9 with Answers
MCQ Questions for CBSE Class 8 with Answers
MCQ Questions for CBSE Class 7 with Answers
MCQ Questions for CBSE Class 6 with Answers
MCQ Questions for CBSE Class 5 with Answers
MCQ Questions for CBSE Class 4 with Answers
MCQ Questions for CBSE Class 3 with Answers
MCQ Questions for CBSE Class 2 with Answers
MCQ Questions for CBSE Class 1 with Answers
Quiz
Quiz
/
Java Class 9 MCQ Questions With Answers
1.
This expression is executed by the for loop only once, regardless of the number of iterations.
a. initialization expression
b. test expression
c. update expression
d. preincrement expression
2.
What does polymorphism mean?
Changing shapes
Having many forms
Being unchangeable
Easy
3.
A class that is inherited is called a ______ .
superclass
Subclass
subsetclass
Relativeclass
4.
What will be the range of possible values generated by the following statement for x?double x = Math.random() * 8 - 5;
[0,3)\left[0,3\right)[0,3)
[−5,3)\left[-5,3\right)[−5,3)
[−5,8)\left[-5,8\right)[−5,8)
[0,8)\left[0,8\right)[0,8)
[3,8)\left[3,8\right)[3,8)
5.
What will the output of the following code segment be?int a = 1, b = 2;System.out.println(++a+”,”+b++);
1,2
2,2
2,3
3,3
6.
How would you declare a variable storing a person's name?
string name = "Elroy";
name String = "Elroy";
String name = Elroy;
String name = "Elroy";
Me llamo Elroy
7.
Class dog implements the animal interface.Which IS a valid declaration?
Dog d = new Animal();
Animal d = new Dog();
Animal d = new Animal();
8.
The following Syntax is used for?class Subclass-name extends Superclass-name { //methods and fields }
Polymorphism
Encapsulation
Inheritance
None of the above
9.
A variable that holds true or false
String
boolean
int
float
Alex Trebek
10.
What data type would you use for storing the number of students in a class?
boolean
String
double
int
11.
What prints out "I love Java" successfully?
System.out.println(I love Java);
Systemoutprintln("I love Java);
System.out.println("I love" + " Java");
System.out.println("I love Java")
What is love? Baby dont hurt me. Dont hurt me. No more.
12.
If more than one class implements an interface, its methods are ____.
aggregated
public
dependent
polymorphic
13.
String s1 = "hello";String s2 = new String("hello");if (s1 == s2) System.out.print("Hey");else System.out.print("Yo");What is the output?
Hey
Yo
There is no output.
This code will not compile.
14.
String s = "good job".substring(3, 9);What is the value of s?
"d job"
"od job"
"d jo"
"od jo"
StringIndexOutOfBoundsException
15.
This expression executes at the end of each iteration of the for loop.
a. initialization expression
b. test expression
c. update expression
d. statement block
16.
Cat class extends Predator class.Which of the following must be true?
A Cat object has access to all Predator variables and methods.
A Predator object has access to all Cat variables and methods.
Cat c = new Predator(); causes an error.
Predator p = new Cat();p has access to Cat methods and uses the Predator implementations.
17.
What will the following program segment display?for(int a = 2; a <= 10; a += 3)System.out.print(a+””);
2 5 8
2 5
2 5 8 11
2
18.
Which of the following statements would successfully call a superclass constructor?
superclass();
super();
superclass("parameter");
construct();
19.
Int x = "quarantine".indexOf("a");What is the value of x?
4
3
2
This code does not compile.
StringIndexOutOfBoundsException
20.
In Java, each child class can have only one parent.
True
False
21.
What is each repetition of a loop known as?
cycle
revlolution
orbit
iteration
Report Question
Previous
Next
warning
Submit
access_time
Time
Report Question
A bunch of text
Support mcqmojo.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page