Quiz 7 Flashcards

(10 cards)

1
Q

T/F
When there is a method overloading in Java, the method that gets called is always determined at run-time based on the method signature.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In Java, all classes inherit from the _______________ class by default.

Map
Iterable
List
Object

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

T/F
Java does not support operator overloading.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T/F
Simula is the first purely object-oriented language. Everything in Simula is an object, including numbers and code itself.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

T/F
Constructors in Java must have a return type of void.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

T/F
In Java, an interface can extend other interfaces using the extends keyword.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

T/F
Java supports multiple inheritance, meaning a class can inherit from more than one base class.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

T/F
What is the output of the following Java code:

String a = new String(“hello”);
String b = new String(“hello”);
System.out.println(a == b);

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the output of the following code:

class A{
public void p(){
System.out.println(“1”);
}
public void q(){
System.out.println(“2”);
}
public void r(){
p();
}
}
class B extends A{
public void p(){
System.out.println(“3”);
}
}
class C extends B{
public void q(){
System.out.println(“4”);
}
}

public class QuizMain {
public static void main(String[] args) {
A a = new C();
a.r();
}
}

2
4
3
1

A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following class does not implement List interface in Java?

Vector
LinkedList
ArrayList
HashSet

A

HashSet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly