
CSC603 Demorgan Law and If statement
Authored by Arwa Hassan
Computers
11th Grade

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?