if else conditionals

if else conditionals

4th - 12th Grade

5 Qs

quiz-placeholder

Similar activities

Back To Basics: Python Lesson 4 - 5 Review

Back To Basics: Python Lesson 4 - 5 Review

5th Grade

10 Qs

Grade 10 Lesson 10 Error Handling Extra Work - 3rd G

Grade 10 Lesson 10 Error Handling Extra Work - 3rd G

10th Grade

10 Qs

Week 7- Technical Drafting 11 (Pre-test)

Week 7- Technical Drafting 11 (Pre-test)

11th Grade

10 Qs

Desain Web kelas 12 by. Mas Arham

Desain Web kelas 12 by. Mas Arham

12th Grade

10 Qs

TYPES OF COMPUTER

TYPES OF COMPUTER

3rd - 4th Grade

10 Qs

Pre-Assessment: ICT 10 Orientation Day

Pre-Assessment: ICT 10 Orientation Day

10th Grade

10 Qs

IT - TYPING TUTOR

IT - TYPING TUTOR

9th Grade

10 Qs

ICT 10 - Quiz - Part 2

ICT 10 - Quiz - Part 2

10th Grade

10 Qs

if else conditionals

if else conditionals

Assessment

Quiz

Computers

4th - 12th Grade

Hard

Created by

Whizara Teacher

FREE Resource

AI

Enhance your content in a minute

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

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What will be the output of the following code?

public class Main

{

  public static void main(String[] args) {

if(5<4)

      System.out.println("Hi");

else

      System.out.println("Hello");

  }

}

Hi

Hello

Compiled Successfully, No Output.

Compile-time error

2.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What will be the output of the following code?

public class Main

{

  public static void main(String[] args) {

int a = 25;

if(a < 5)

      System.out.println("Hi");

if(a < 20)

   System.out.println("Hello");

else

      System.out.println("Hola");

  }

}

Hi

Hello

Hola

Compile-time error

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What does the following code print when x has been set to 187?

if (x < 0)

{

   System.out.println("x is negative");

}

else if (x == 0)

{

    System.out.println("x is zero");

}

else

{

    System.out.println("x is positive");

}

x is zero

x is negative

x is positive

none of the mentioned

4.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What is the value of grade when the following code executes and score is 80?

if (score >= 90) grade = "A";

if (score >= 80) grade = "B";

if (score >= 70) grade = "C";

if (score >= 60) grade = "D";

else grade = "E";

A

B

C

D

Answer explanation

Each of the if statements will be executed. So grade will be set to B then C and finally D.

5.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

  An else statement should be preceded by?

if statement only

else if statement only

either if or else if statement

none of the mentioned

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?