Search Header Logo

java

Authored by M Z

Computers

KG - Professional Development

Used 1+ times

java
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

What is the output?


public class testincr

{

public static void main(String args[])

{

int i = 0;

i = i++ + i;

System.out.println(“I = ” +i);

}

}

(a) I = 0

(b) I = 1

(c) I = 2

(d) I = 3

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Multiple inheritance means?

one class inheriting from more super classes

more classes inheriting from one super class

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement is not true in java language

A public member of a class can be accessed in all the packages.

A private member of a class cannot be accessed by the methods of the same class.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the type and value of the following expression? (Notice the integer division)

-4 + 1/2 + 2*-3 + 5.0

int -5

double -4.5

int -4

double -5.0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public static int foo(int a, String s)

{

s = “Yellow”;

a=a+2;

return a;

}

public static void bar()

{

int a=3;

String s = “Blue”;

a = foo(a,s);

System.out.println(“a=”+a+” s=”+s);

}

public static void main(String args[])

{

bar();

}

a = 3 s = Blue

a = 5 s = Yellow

a = 3 s = Yellow

a = 5 s = Blue

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

blic class Test {

public static void main( String[] args ) {

int[] a = { 430, 1, 245, 3, 416, , 5, 243, 123, 77}; // int result = 0;

// for ( int i = 0; i < a.length; i++ )

// {

// if(a[i]>10)

// result+=a[i];}

System.out.printf( "Result is: %d\n", a[9] ); System.out.printf( "Result is: %d\n", a[a[2]-a[0]] );

Result is 77, result is 7

Result is 123, result is 23

Result is 416, result is 316

Result is 430, result is 330

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is information being hide the implemented in Java?

It’s declare then create the array.

Create object in java

The private variables and defining public methods to access them.

Local variables are automatically initialized

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?