
PU - Day 1 assessments - Sivaram's class
Authored by training atomm
Professional Development
Professional Development
Used 1+ 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
30 sec • 1 pt
What will be the output of the following Java program?
class selection_statements
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2);
}
}
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class test_output
{
public static void main(String args[])
{
int a = 10;
int b = 20;
if (a < b)
System.out.print(a + b);
else
System.out.print(a - b);
}
}
20
-10
30
10
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class comparison_test
{
public static void main(String args[])
{
int x = 15;
int y = 10;
if (x != y)
System.out.print(x);
else
System.out.print(y);
}
}
0
10
15
20
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class increment_test
{
public static void main(String args[])
{
int count = 5;
if (++count > 5)
System.out.print(count);
else
System.out.print(count - 1);
}
}
7
4
6
5
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class logical_test
{
public static void main(String args[])
{
boolean a = true;
boolean b = false;
if (a && b)
System.out.print("True");
else
System.out.print("False");
}
}
Exception
Null
False
True
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class ternary_test
{
public static void main(String args[])
{
int num = 8;
String result = (num % 2 == 0) ? "Even" : "Odd";
System.out.print(result);
}
}
Even
Odd
Null
None
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class switch_case_test
{
public static void main(String args[])
{
int day = 3;
switch (day)
{
case 1:
System.out.print("Monday");
break;
case 2:
System.out.print("Tuesday");
break;
case 3:
System.out.print("Wednesday");
break;
default:
System.out.print("Invalid day");
}
}
Tuesday
Monday
Wednesday
Invalid day
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?