Search Header Logo

Java Programming Structures

Authored by Jeevitha P

Computers

University

Used 61+ times

Java Programming Structures
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How is a single line comment created in Java?

Two backward slashes at the beginning indicate that the line is a comment

Two forward slashes at the beginning indicate that the line is a comment.

A forward slash followed by two asterisks at the beginning indicate that the line is a comment.

A forward slash followed by an asterisk at the beginning indicate that the line is a comment.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be output of below program?

public class Test {

public void main(String[] args) {

int x = 10*20-20;

System.out.println(x);

}

}

Runtime Error

Prints 180

Prints 0

None of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Main {

public static void main(String args[]) {

int t;

System.out.println(t);

}

}


What is the output?

0

Garbage Value

Compiler Error

Runtime Error

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Predict the output of following Java Program

class Test {

public static void main(String args[])

{ int x = -4;

System.out.println(x>>1);

int y = 4;

System.out.println(y>>1); } }

Compiler Error: Operator >> cannot be applied to negative numbers

-2

2

2

2

0

2

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which one of the following is NOT a correct variable name?

2bad

zero

theLastValueButOne

year2000

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the need to mention "static" before main method?

To call main method without creating an object of class

To make main method as class method common to all instances

Both A and B

None of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Choose a correct version of Java Documentation Comment?

/*

comments

*/

/**

comments

*/

/*

comments

**/

/**

comments

**/

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?

Discover more resources for Computers