
conditional constructs in Java
Authored by Anita Thakur
Computers
10th Grade
Used 199+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public void main()
{
double temp = 56.0;
if (temp <=54.0 && temp>40)
System.out.println(“It is too hot”);
else if ( temp<40 || temp>30)
System.out.println(“It is hot but not too much”);
else
System.out.println(“It is pleasant”);
}
What will be the output?
It is too hot
It is pleasant
It is hot but not too much
runtime error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
PREDICT THE OUTPUT:
int x = 20;
int y = 18;
if(x>y)
System.out.println("x is greater than y");
else
{
System.out.println("Error");
System.out.println("Incorrect code");
}
Error
Incorrect code
x is greater than y
Error
Incorrect code
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
PREDICT THE OUTPUT:
int x = 60;
int y = 90;
if (y%x == 0 && y-x==30)
{
System.out.println("Hello World");
}
else
{
System.out.println("Error")
}
Hello World
Hello world
Error
Hello World
Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Re-write above statement using ternary operator-
if(X<=Y) then X=Y else Y=X;
if(X<=Y) ? X=Y : Y=X;
(X<=Y) ? X=Y : Y=X;
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int marks = 50;
if( marks > 70 )
System.out.println("Distinction");
else if( marks > 35 )
System.out.println("Pass");
else
System.out.println("Fail");
Pass
Distinction
Fail
Pass
Fail
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int marks = 80;
if( marks > 70 )
System.out.println("Distinction");
System.out.println("Congratulations");
else if( marks > 35 )
System.out.println("Pass");
Distinction
Congratulations
Pass
Distinction
Error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
"if" is a conditional construct?
True
False
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?
Similar Resources on Wayground
10 questions
Validación de Datos
Quiz
•
10th Grade
14 questions
BÀI 14- THUẬT TOÁN TÌM KIẾM TUẦN TỰ
Quiz
•
6th Grade - University
10 questions
10° Bimestral informática 3° periodo
Quiz
•
10th Grade
14 questions
Linux: Users and Groups
Quiz
•
9th Grade - University
10 questions
Les variables sous Python
Quiz
•
10th - 12th Grade
12 questions
FTP
Quiz
•
1st - 10th Grade
14 questions
Archivos Digitales
Quiz
•
9th Grade - University
15 questions
PRUEBA CORTA I - SISTEMA E INSTALACIÓN DE SOFTWARE I - U4
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade