COP3252 Chapter 1 - 4 Flashcards
T or F
Information in the memory unit is persistent-it is retained when the copmuter’s power is turned off
False
What does a compiler do?
A compiler translates high-level languages like java into machine language.
What is unified modelling language (UML)
UML is a graphical language used to represent a software system.
Object-oriented design
used to model software in terms of objects
How are comments represented in Java?
using (//)
What command is used to compile a Java class file?
javac file.java
Given the existence of a file named MyClass.class what does the following command do:
java MyClass
This command executes the main file in MyClass.
A _______ enables a program to read data from the user.
Scanner
Which of the following is not a valid Java primitive type?
double
char
byte
real
real
Attributes of a class are known as
Local Variables
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!” );
The porridge is too hot
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!
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