Question
I. What is the output of the following poorly indented code fragments? 1. somenumber = 100; if (somenumber > 50) System.out.print(first ); System.out.print(second ); System.out.print(third);
I. What is the output of the following poorly indented code fragments?
1. somenumber = 100;
if (somenumber > 50)
System.out.print("first "); System.out.print("second "); System.out.print("third");
2. somenumber = 40;
if (somenumber > 50)
System.out.print("first "); System.out.print("second "); System.out.print("third");
3) somenumber = 100;
if (somenumber > 50)
{
System.out.print("first "); System.out.print("second ");
}
System.out.print("third");
4) somenumber = 40;
if (somenumber > 50)
{
System.out.print("first "); System.out.print("second ");
}
System.out.print("third");
5) somenumber = 100;
if (somenumber > 50)
System.out.print("first ");
else
System.out.print("second "); System.out.print("third");
6) somenumber = 40;
if (somenumber > 50)
System.out.print("first ");
else
System.out.print("second "); System.out.print("third");
7) if ((5.2 > 3.3 && 6.2 < 9.9) && (6.2 < 3.5 || 4.2 = = 3.1 || 3.1 ! = 3.14)) System.out.print("TRUE");
else
System.out.print("FALSE");
II. Answer Yes or No:
8) If the body of the if contains only a single statement then are braces required around the statement?
9) Is the expression !(x > 10) equivalent to the expression x < 10?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started