
MileStone 1 - Java - MCQS

Quiz
•
Computers
•
University
•
Hard
Prema,Asst.Prof, Chennai
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which one of the following statement is false?
A subclass must override all the methods of the superclass
it is possible for a subclass to define a method with the same name and parameters as a method defined by the superclass
Aggregation defines a has-a relationship between a superclass and its subclasses
Inheritance defines a is-a relationship between a superclass and its subclass
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following
class A{
public void baz(){
System.out.println(“A”);
}
}
public class B extends A{
public static void main(String [] args){
A a = new b();
a.baz();
}
public void baz(){
System.out.println(“B”);
}
}
What is the result?
A
B
Compilation fails
An exception is thrown at runtime
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following
class Over{
int doStuff(int a, float b){
return 7;
}
}
class Over2 extends Over{
//insert code here
}
Which method, if inserted at line 8, will not compile?
public int doStuff(int x, float y) {return 4;}
protected int doStuff(int x, float y) {return 4;}
private int doStuff(int x, float y) {return 4;}
private int doStuff(int x, double y) {return 4;}
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the below mentioned code and the command-line invocation as,
Java CommandArgs 1 2 3 4
public class CommandArgs {
public static void main(Strings[] args) {
String s1 = args[1];
String s2 = args[2];
String s3 = args[3];
String s4 = args[4];
System.out.print(“args[2] = “ +s2);
}
}
What is the result?
args[2] = 2
args[2] = 3
args[2] = 1
An exception is thrown at runtime
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
5. Which one of the following statements is true?
an abstract class can be instantiated
An abstract class is implicitly final
An abstract class can declare non-abstract methods
An abstract class can not extend a concrete class
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement is true about interfaces?
a. Interfaces allow multiple implementation inheritance
b. Interfaces can extend any number of other interfaces
c. Members of an interface are never static
d. Members of an interface can always be declared static
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A class Car and its subclass Yugo both have a method run() which was written by the programmer as part of the class definition. If junker refers to an object of type Yugo, what will the following code do?
junker.run();
The run() method defined in Yugo will be called
The run() method defined in Car will be called
The compiler will complain that run() has been defined twice
Overloading will be used to pick which run() is called
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Structure in C

Quiz
•
University
10 questions
cp06-01-1D-Array

Quiz
•
University
10 questions
Exception Handling and CollectionQuiz

Quiz
•
University
10 questions
Java Arrays

Quiz
•
University
15 questions
Wipro PRP - 7th June 2023

Quiz
•
University
15 questions
Java Basic Quizz

Quiz
•
University
15 questions
II CSM A & B

Quiz
•
University
10 questions
Basics of C

Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
11 questions
NFL Football logos

Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms

Quiz
•
11th Grade - University
20 questions
La Hora

Quiz
•
9th Grade - University
7 questions
Cell Transport

Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?

Interactive video
•
4th Grade - University