Java Foundation_1

Java Foundation_1

Professional Development

15 Qs

quiz-placeholder

Similar activities

C# lesson10

C# lesson10

1st - 10th Grade

10 Qs

ICT Grade 8 Model exam Altaluq private school Excel

ICT Grade 8 Model exam Altaluq private school Excel

8th Grade

20 Qs

 Spring AI Introduction

Spring AI Introduction

KG

10 Qs

DreamWeaver CS6

DreamWeaver CS6

University

20 Qs

Arduino_Quiz

Arduino_Quiz

12th Grade

20 Qs

Kuis Dadakan ;)

Kuis Dadakan ;)

10th Grade - University

15 Qs

1-基本数据类型

1-基本数据类型

University

10 Qs

Računalno razmišljanje i programiranje 2. dio 2025.

Računalno razmišljanje i programiranje 2. dio 2025.

7th Grade

20 Qs

Java Foundation_1

Java Foundation_1

Assessment

Quiz

Computers

Professional Development

Practice Problem

Medium

Created by

Rukumani CT_PG

Used 7+ 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

What is the result of the following program?

public class MathFunctions {

public static void addToInt(int x, int amountToAdd) {

x = x + amountToAdd;

}

public static void main(String[] args) { var a = 15;

var b = 10;

MathFunctions.addToInt(a, b); System.out.println(a); } }

10

15

25

Compile Error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct signature of the main method in Java?

public static void main(String[] args)

public void main(String[] args)

private static void main(String[] args)

public static void main()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid way to declare an array in Java?

int[] arr = new int[5];

int arr[] = new int(5);

int arr = new int[5];

array int arr = new int[5];

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

public class Test {

public static void main(String[] args) {

String str = "Hello";

str.concat(" World");

System.out.println(str);

}

}

Hello

Hello World

Compile Error

Runtime Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code snippet?

public class Example {

public static void main(String[] args) {

int x = 10;

if (x > 5) {

x += 5;

} else {

x -= 5;

}

System.out.println(x);

}

}

5

10

15

Compile Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following program? (Choose all that apply.)

interface HasTail { int getTailLength(); }

abstract class Puma implements HasTail {

protected int getTailLength() { return 4; } }

public class Cougar implements HasTail {

public static void main(String[] args) { var puma = new Puma();

System.out.println(puma.getTailLength());

}

public int getTailLength(int length) { return 2; } }

2

4

Code will not compile

Output cannot be determined

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

public class Example {

public static void main(String[] args) {

int a = 5;

int b = 10;

System.out.println(a + b);

}

}

5

10

15

Compile 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?