Java

Java

University

30 Qs

quiz-placeholder

Similar activities

Data Structure(FINAL)

Data Structure(FINAL)

University

25 Qs

Тест на знание C#

Тест на знание C#

University

25 Qs

Code war

Code war

University

30 Qs

1. Intro to Java

1. Intro to Java

University

25 Qs

Java Programming

Java Programming

University

30 Qs

Error Handling Pada Java

Error Handling Pada Java

University

25 Qs

java

java

University

28 Qs

Java Basics Recap

Java Basics Recap

9th Grade - University

25 Qs

Java

Java

Assessment

Quiz

Computers

University

Medium

Created by

Subba Chavva

Used 1+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a class in object-oriented programming?

A variable that holds multiple values

A type of exception handling mechanism

A blueprint for creating objects

A method that performs calculations

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does encapsulation mean in Java?

Hiding the implementation details of a class

Creating multiple instances of a class

Using class inheritance

Combining multiple classes into one

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which Java feature allows a subclass to inherit properties and behaviors from a superclass?

Encapsulation

Polymorphism

Abstraction

Inheritance

4.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is the output of the following Java program?

public class MyClass {

    int x;

    public MyClass(int val) {

        x = val;

    }

    public static void main(String[] args) {

        MyClass obj = new MyClass(5);

        System.out.println(obj.x);

    }

}

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements correctly initializes an array of integers in Java?

int[] numbers = new int[5]();

int[] numbers = new int[5];

int numbers[5];

int[] numbers = {1, 2, 3, 4, 5};

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is the output (value only) of the following Java program?

public class Circle {

    double radius;

    public Circle(double r) {

        radius = r;

    }

    public double calculateArea() {

        return Math.PI radius radius;

    }

    public static void main(String[] args) {

        Circle c = new Circle(3.0);

        System.out.println( c.calculateArea());

    }

}

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access the third element of an array named scores?

scores.get(3)

scores.third

scores[2]

scores(3)

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?