Java Static

Java Static

University

10 Qs

quiz-placeholder

Similar activities

Dr. S. Uma's Object Oriented Programming Quiz Event 1

Dr. S. Uma's Object Oriented Programming Quiz Event 1

University

10 Qs

EC8393_FDS_MODEL EXAM_3_PART B

EC8393_FDS_MODEL EXAM_3_PART B

University

15 Qs

Quiz 1

Quiz 1

University

10 Qs

Computational Thinking in Python[Quiz 3]

Computational Thinking in Python[Quiz 3]

University

15 Qs

JRB2 Quiz 4

JRB2 Quiz 4

University

10 Qs

CC103 - Seatwork 1

CC103 - Seatwork 1

University

15 Qs

COMPUTER NETWORK & SECURITY (QUIZ #4) MIDTERM 2024

COMPUTER NETWORK & SECURITY (QUIZ #4) MIDTERM 2024

University

15 Qs

java quiz based on interface

java quiz based on interface

University

10 Qs

Java Static

Java Static

Assessment

Quiz

Computers

University

Hard

Created by

Jeevitha P

Used 185+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

what is the output of this question?

class Test1 {

public

static void main(String[] args)

{

int x = 20;

System.out.println(x);

}

static

{

int x = 10;

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

}

}

10 20

20 10

10 10

20 20

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Predict the output of the following program.


class A{

int a=40;//non static

public static void main(String args[]){

System.out.println(a);

}

}

Compilation Error

40

0

None of the above

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

what is the output of this question?

class Test1 {

static int x = 10;

public

static void main(String[] args)

{

Test1 t1 = new Test1();

Test1 t2 = new Test1();

t1.x = 20;

System.out.print(t1.x + " ");

System.out.println(t2.x);

}

}

10 10

20 20

10 20

20 10

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of this question?

class Test1 {

static int i = 1;

public static void main(String[] args)

{

for (int i = 1; i < 10; i++) {

i = i + 2;

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

}

}

}

3 6 9

3 6 9 …. 27

Error

none

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of this question?

class Test1 {

static int i = 1;

public static void main(String[] args)

{

int i = 1;

for (Test1.i = 1; Test1.i < 10; Test1.i++) {

i = i + 2;

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

}

}

}

1 3 9

1 2 3 … 9

3 5 7 9 11 13 15 17 19

None

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which one of the following is a valid statement?

char[] c = new char();

char[] c = new char[5];

char[] c = new char(4);

char[] c = new char[];

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What will be the output?

public class Test

{

public static void main(String args[])

{

int[] x=new int[3];

System.out.print("x[0] is" + x[0]);

}}

The program has a compile error because the size of the array wasn't specified when declaring the array.

The program has a runtime error because the array elements are not initialized.

The program runs fine and displays x[0] is 0.

The program has a runtime error because the array element x[0] is not defined

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?