Java Summative Assessment 2

Java Summative Assessment 2

12th Grade

20 Qs

quiz-placeholder

Similar activities

Java March

Java March

KG - University

16 Qs

Pra-PSPM SC025(F04)

Pra-PSPM SC025(F04)

12th Grade

24 Qs

AP Computer Science A

AP Computer Science A

10th - 12th Grade

20 Qs

Susulan PBO XIRPL (2021/2022)

Susulan PBO XIRPL (2021/2022)

11th Grade - University

20 Qs

Java Level 1 - B

Java Level 1 - B

12th Grade

15 Qs

AP CSA Java Arrays

AP CSA Java Arrays

9th - 12th Grade

18 Qs

AP CSA Arrays

AP CSA Arrays

9th - 12th Grade

18 Qs

Java Loops

Java Loops

10th - 12th Grade

24 Qs

Java Summative Assessment 2

Java Summative Assessment 2

Assessment

Quiz

Computers

12th Grade

Easy

Created by

chrisbenedict sevilleno

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this code?

```java

int x = 5;

if (x > 0) {

System.out.println("Positive");

} else {

System.out.println("Negative");

}

Positive

Negative

Nothing

Error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which symbol is used for the "not equal to" comparison in an if statement?

`!=`

`==`

`>`

`<>`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this code print?

```java

int age = 16;

if (age >= 18) {

System.out.println("Adult");

} else {

System.out.println("Minor");

}

```

Adult

Minor

Nothing

Error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for an if-else statement?

`if condition { } else { }`

`if (condition) { } else { }`

`if [condition] { } else { }`

`if condition then { } else { }`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this code output?

```java

int num = 10;

if (num % 2 == 0) {

System.out.println("Even");

} else {

System.out.println("Odd");

}

Even

Odd

Nothing

Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this code print?

```java

boolean isSunny = false;

if (isSunny) {

System.out.println("Go outside");

} else {

System.out.println("Stay inside");

}

Go outside

Stay inside

Nothing

Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is missing in this code to make it compile?

```java int x = 7;

if x > 5 {

System.out.println("Big");

}

```

Parentheses around the condition

Curly braces

Semicolon after the condition

A variable declaration

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?