Java Programming Practice Questions

Java Programming Practice Questions

University

15 Qs

quiz-placeholder

Similar activities

BASIC C PROGRAMMING

BASIC C PROGRAMMING

University

15 Qs

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

University - Professional Development

20 Qs

basisdata1

basisdata1

University

20 Qs

Pengantar Coding

Pengantar Coding

University

10 Qs

CSC1243 - Introduction to Computer Programs (Programming Langua)

CSC1243 - Introduction to Computer Programs (Programming Langua)

University

10 Qs

OOP 1 Undiksha

OOP 1 Undiksha

12th Grade - University

13 Qs

MULTIMEDIA STORYBOARD

MULTIMEDIA STORYBOARD

University

10 Qs

UNIT-1 PYTHON BASICS

UNIT-1 PYTHON BASICS

University

10 Qs

Java Programming Practice Questions

Java Programming Practice Questions

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

THRUPAWAI Moe

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int a = 5, b = 7; System.out.println("Result: " + (a++ + ++b));

Result: 12

Result: 13

Result: 14

Result: 15

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method will correctly determine if two String variables, str1 and str2, contain the exact same sequence of characters?

str1 == str2

str1.equals(str2)

str1.compareTo(str2)

str1.match(str2)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the incorrect statement regarding constructors in Java.

Constructors must have the same name as the class.

Constructors can return any type.

Constructors can be overloaded.

Constructors are used to initialize objects.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

boolean flag = true; if (flag == false) { System.out.println("False"); } else { System.out.println("True"); }

False

True

Compilation Error

Runtime Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword in Java is used to prevent method overriding?

static

final

void

private

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Choose the correct way to declare and initialize a one-dimensional integer array.

int arr[] = new int[];

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

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

int arr = {1,2,3,4,5};

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which access modifier restricts access only within its own class?

public

protected

private

default

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

Already have an account?