Search Header Logo

Day 11

Authored by DATTA SAI SANTHOSH

Education

1st - 5th Grade

Used 3+ times

Day 11
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between method overloading and method overriding?

Method overloading is static polymorphism, while method overriding is dynamic polymorphism.

Method overloading is used in inheritance, while method overriding is used in abstraction.

Method overloading is when a subclass provides a different implementation of a method, while method overriding is when a subclass has multiple methods with the same name.

Method overloading is used for access control, while method overriding is used for code reusability.

Answer explanation

Method overloading is static polymorphism, while method overriding is dynamic polymorphism

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a benefit of using packages in Java?

Encapsulation and information hiding

Improved code reusability

Easy management of large projects

Faster execution of Java programs

Answer explanation

Faster execution of Java programs

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is/are not advantages of packages?

packages avoid name clashes.

classes even though they are visible outside their package, can have visible to packages only

we have hidden classes that are used by the packages, but not bisible outside.

all the above

Answer explanation

classes even though they are visivle outside theor package,can have visible to packages only

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

// Note static keyword after import.

import static java. lang. System.*;

class StaticImportDemo

{

public static void main(String args[])

{

out.println("wipro training");

}

}

Wipro training

compile Error

Runtime error

None of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to establish inheritance in Java?

inherits

extends

inheritsFrom

implements

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output of the following program.?

abstract class demo

{

public int a;

demo()

{

a = 10;

}

abstract public void set();

abstract final public void get();

}

class Test extends demo

{

public void set(int a)

{

this.a = a;

}

final public void get()

{

System.out.println("a = " + a);

}

public static void main(String[] args)

{

Test obj = new Test();

obj.set(20);

obj.get();

}

}

Compilation error

a=10

a=20

Runtime error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can an interface contain variables?

Yes, only static variables.

Yes, only final variables.

No, interfaces cannot have variables

Yes, but they must be final and static.

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?