In: Computer Science
Q1: Which of the following is not an algorithm?
Q2: Which of the following is true?
Q3: Which of the following is not a benefit of “goto-less programming”?
Q4: Which of the following is not a control structure:
Q5: Which of the following is an action-state symbol?
Q6: Which statement is false?
Q7: Which of the following is a double-selection control statement?
Q8: Which of the following is not a Java keyword?
Q9: What is output by the following Java code segment?
int temp;
temp = 200;
if ( temp > 90 )
System.out.println( "This porridge is too hot." );
if ( temp < 70 )
System.out.println( "This porridge is too cold." );
if ( temp == 80 )
System.out.println( "This porridge is just right!" );
Q10: A decision symbol in an activity diagram takes the shape of a ________.
Q11: Which of the following is not included in an activity diagram for a control structure?
Q12: Which of the following is not true about the conditional operator ( ?: )?
Q13: What is output by the following Java code segment?
int temp;
temp = 180;
if ( temp > 90 )
{
System.out.println( "This porridge is too hot." );
// cool down
temp = temp – ( temp > 150 ? 100 : 20 );
} // end if
else
{
if ( temp < 70 )
{
System.out.println("This porridge is too cold.");
// warm up
temp = temp + (temp < 50 ? 30 : 20);
} // end if
} // end else
if ( temp == 80 )
System.out.println( "This porridge is just right!" );
Q14: A dangling-else can be clarified by using:
Q15: The empty statement is denoted with what symbol?
ANS: a. Semicolon ;
Q16: Which statement is false?
Q17: What is output by the following Java code segment?
int temp;
temp = 180;
while ( temp != 80 )
{
if ( temp > 90 )
{
System.out.print( "This porridge is too hot! " );
// cool down
temp = temp – ( temp > 150 ? 100 : 20 );
} // end if
else
{
if ( temp < 70 )
{
System.out.print(
"This porridge is too cold! ");
// warm up
temp = temp + (temp < 50 ? 30 : 20);
} // end if
} // end else
} // end while
if ( temp == 80 )
System.out.println( "This porridge is just right!" );
Q18: Which of the following is not an error (either a syntax error or a logic error)?
Q19: In an activity diagram, the merge symbol has the same shape as what other symbol?
Q1)
c. Textook index
It has table of contents. it doesnt say abot any actions
Q2)
c)Pseudocode is used to describe executable statements that will eventually be translated by the programmer into a program.
Q3)
b Shorter
Q4)
d. Action Structure
Q5)
c)rectangles with left and right sides replaced with arcs curving outward.
Q6)
b)Activity diagrams normally show the Java code that implements the activity.
Q7)
if…else.
Q8)
b) next
Q9)
a) This porridge is too hot.
Q10)
a. Diamond.
Q11)
b) Attribute
Q12)
c. The second operand is the result value if the condition evaluates to false.
Q13)
d.None of the above.
Q14)
c. Braces {}
Q15)
a. Semicolon ;
Q16)
c. Syntax errors arecaught by the compiler. Logic errors have effects at execution time. d. Logic errors are caught by the
Q17)
b. This porridge is too hot! This porridge is just right!
Q18)
c. Using a condition for a while structure that is initially
false
Q19)
a. Decision symbol