Search Header Logo

java 13-10-2023

Authored by DEVAKI AMIR

Computers

Professional Development

Used 1+ times

java 13-10-2023
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

Choose the correct identifier for a method name in Java.

1show

$hide

*show$

3_click

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of any Logical operation in Java?

1 or 0

true or false

char or String

None of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The method parameters can be redeclared in the method body

true

false

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

The private member of a class can be accessible


a) Within the class in which it is declared

b) Within all the sub-classes of its class in any package where this class is visible

c) Within all the classes in the package containing its class

both a and b

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

class c
{
private static int p1=20;
protected static int p2=40;

protected static int func1() {
return p1;
}
}

class testClass extends c{

protected static int func2() {
return p2+func1();
}

public static void main(String[] args ) {
System.out.println(func2());
}
}

60

Compilation error- The field c.p1 is not visible

40

0

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Check the below code and state whether it is called Recursion in Java?

void methodA()

{ methodB(); }

void methodB()

{ methodA(); }

TRUE

FALSE

Answer explanation

Explanation:

No, not at all. In the above code, the first method calls the second method and the second method calls the first method. 

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

public class RecursionTesting {

static int num=4;

public static void main(String[] args) {

new RecursionTesting().recursiveMethod(); }

void recursiveMethod() {

num--;

if(num == 0)

return;

System.out.print(num + " ");

recursiveMethod(); } }

4 3 2 1

3 2 1

3 2 1 0

Compiler error

Answer explanation

Note that this recursive method does not return anything. It simply does the printing of some values.

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?