JAVA COP3252 Chapters 1 -4

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

How many times is the body of the loop below executed? int counter = 1; while ( counter > 20 ) { // body of loop counter = counter - 1; } // end while

0

________ is a graphical language that allows people who design software systems to use an industry stan¬dard notation to represent them.

The Unified Modeling Language

Information in the memory unit is persistent—it is retained when the computer's power is turned off. T or F.

false

T or F System.out.println( "Hello world!" ); contains a syntax error.

false

Which command compiles the Java source code file Welcome.java?

javac Welcome.java

Which of the following is not a Java keyword?

next

What is the default value of a reference?

null

Every Java application is composed of at least one:

public class declaration

A(n) ________ enables a program to read data from the user.

scanner

T or F - Declaration structure is not a control structure

true

T or F Compilers translate high-level language programs into machine language programs.

true

T or F - nextLine is not a Scanner method?

False

What does the expression x %= 10 do?

Divides x by 10 and stores the remainder in x.

Which class provides prebuilt dialog boxes that enable programs to display windows containing messages (such windows are called message dialogs)?

JOptionPane

What is output by the following Java code segment? int 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!" );

This porridge is too hot

What is the result value of c at the end of the following code segment? int c = 8; c++; ++c; c %= 5;

0

End-of-line comments that should be ignored by the compiler are denoted using

2 forward slashes //

________ models software in terms similar to those that people use to describe real-world objects.

Object-oriented design

Which command executes the Java class file Welcome.class?

java Welcome

What is output by the following Java code segment? int 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!" );

none of these

What is output by the following Java code segment? int 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!" );

This porridge is too hot! This porridge is just right!


Kaugnay na mga set ng pag-aaral

Dynamics of Personality - Chapter 9

View Set

Developing an Oral Report Language Arts 800

View Set