CSC603 Demorgan Law and If statement

CSC603 Demorgan Law and If statement

11th Grade

9 Qs

quiz-placeholder

Similar activities

Test on Python Function

Test on Python Function

11th - 12th Grade

12 Qs

CodeHS While Loops

CodeHS While Loops

9th - 12th Grade

12 Qs

Cấu trúc rẽ nhánh

Cấu trúc rẽ nhánh

11th Grade

10 Qs

Java While Loop

Java While Loop

9th - 12th Grade

8 Qs

AP CS A Quiz 4 Practice

AP CS A Quiz 4 Practice

9th - 12th Grade

9 Qs

Math Class Quiz

Math Class Quiz

10th - 12th Grade

12 Qs

Loops

Loops

9th - 12th Grade

12 Qs

If/Else

If/Else

9th - 12th Grade

10 Qs

CSC603 Demorgan Law and If statement

CSC603 Demorgan Law and If statement

Assessment

Quiz

Computers

11th Grade

Hard

Created by

Arwa Hassan

FREE Resource

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to write an if statement in Java?

  • if x > 10

  • then

  • {

  • System.out.println("x is greater than 10");

  • }

  • if (x > 10)

  • {

  • System.out.println("x is greater than 10");

  • }

  • if x > 10:

  • System.out.println("x is greater than 10");

  • if (x > 10)

  • System.out.println("x is greater than 10")

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

int a = 5;

if (a == 5)

System.out.println("A is 5");

else

System.out.println("A is not 5");

No output

A is not 5

A is 5

Compilation error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following if statement check?

if (x >= 0 && x <= 10)

If x is less than 0 or greater than 10

If x is greater than or equal to 0 and less than or equal to 10

If x is equal to 0 or 10

If x is not equal to 0 or 10

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of this code?
int a = 10;

if (a == 5)

System.out.println("Output 1 );

else if (a > 5)

System.out.println(" Output 2 ");

else System.out.println("Output 3");

Output 1

output 2

output 3

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct negation of the expression !(a || b) using De Morgan's Law?

a && b

!a && !b

a || !b

!a || !b

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Using De Morgan's Law, what is the negation of the condition (x < 5) && (y >= 7)?

  • (x >= 5) || (y < 7)

  • (x > 5) || (y > 7)

  • (x < 5) || (y < 7)

  • (x >= 5) && (y < 7)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of applying De Morgan's Law to the expression

!(x > 10 && y < 20)?

(x <= 10) || (y >= 20)

(x < 10) && (y > 20)

(x >= 10) || (y <= 20)

(x <= 10) && (y >= 20)

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is equivalent to

!(a && b)?

a || !b

!a || !b

!a && !b

a && b

9.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If x and y are booleans, which of the following is equivalent to !(x || y) using De Morgan's Law?

x && y

!x && !y

!x || !y

x || y