Search Header Logo

Milestone 1 Quiz WTN

Authored by Prema,Asst.Prof, Chennai

Computers

University

Used 1+ times

Milestone 1 Quiz WTN
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement is not true about maps?

All keys in a map are unique

The return type of the values() method is a Collection

The Map interface extends the Collection interface

Elements of a LinkedHashMap are ordered by insertion order

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following program:

public class Demo{

public static void main(String args[]){

int variable1 = 10;

do{

if(variable1==10){

break;

}else{

variable1++;

System.out.println(variable1);

}

}while(variable1<10);

}

}

a. 10

b. 11

c. No Output

d. Compilation Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

import java.util.*;

public class TestCollection {

    public static void main(String args[]) {

        Object al = new ArrayList();

        Object hs = new HashSet();

        Object hm = new HashMap();

        System.out.println(String.format("%s,%s,%s", al instanceof Collection, hs instanceof Collection, hm instanceof Collection));

    }

}What is the result of attempting to compile and run the program?

false,false,true

true,true,false

true,false,true

true,true,true

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following program:

public class Demo{

public static void main(String args[]){

int[] myArray = {1,2,3,4,5};

for(int counter:myArray){

System.out.println(++counter);

}

}

}

2

3

4

5

6

1

2

3

4

5

No Output

Compilation Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given classes A, B, and C, where B extends A, and C extends B, and where all classes implement the instance method void doIt(). How can the doIt() method in A be called from an instance method in C?

super.doIt()

super.super.doIt()

A.this.doIt()

It is not possible

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Using which one of the following keyword we can exclude some object properties from serialization process?

transient

exclude

omit

native

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement is true?

Private methods of a superclass cannot be overridden n subclasses

A subclass can override any method present in a superclass

An overriding method can declare that it throws more exceptions than the method it is overriding

The parameter list of an overriding  method must be a subset of the parameter list of the method that it is overriding

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?