Search Header Logo

Java Quiz1 Basics and OOPS

Authored by Surekha Rajeshwari

Professional Development

Professional Development

Used 2+ times

Java Quiz1 Basics and OOPS
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

Predict the output:

int arr[ ] = new int[5];

System.out.println(arr[1]);

1
0
null
garbage value

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output:

package main;

class Main {

public static void main(String args[]) {

int t;

System.out.println(t); } }

0
Garbage Value
complie time error
runtime error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Main {

public static void main(String args[]) {

int arr[] = {10, 20, 30, 40, 50};

for(int i=0; i < arr.length; i++) {

System.out.print(" " + arr[i]);

} } }

10 20 30 40 50
10 20 30 40
complie time error
runtime error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the immediate parent class for Integer, Float and Long classes?

Object Class
Wrapper Class
Number Class
none of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

predict the output:

abstract class Sample{ //Line0

public int a; //Line1

demo(){ //Line2

a=10; //Line3

} }

Line0 : abstract class must be public
Line1: abstract class cannot have instace variables
Line2: demo() Return type for the method is missing
Line3: Illegal initialization

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

predict the output: abstract class Sample{

Sample(){

super(); //Line1

}

abstract final public get(); //Line2

public static void check() { //Line3

System.out.println("Static checking"); } }

Line1: abstract class cannot call super
Line2:Cannot pair abstract final
Line3: abstract class cannot have static methods
all 3 lines are with compile time error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output:

abstract class Sample{

Sample(){

super(); //Line1

}

public final void get() { //Line2

System.out.println(); }

public static abstract void check(); //Line3

}

Line1: abstract class cannot call super
Line2: abstract class cannot have final method
Line3: static and abstract cannot be paired
all 3 lines are with compile time error

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 Professional Development