COP3252 Chapter 1 - 4 Flashcards

1
Q

T or F

Information in the memory unit is persistent-it is retained when the copmuter’s power is turned off

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a compiler do?

A

A compiler translates high-level languages like java into machine language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is unified modelling language (UML)

A

UML is a graphical language used to represent a software system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Object-oriented design

A

used to model software in terms of objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How are comments represented in Java?

A

using (//)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What command is used to compile a Java class file?

A

javac file.java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Given the existence of a file named MyClass.class what does the following command do:

java MyClass

A

This command executes the main file in MyClass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A _______ enables a program to read data from the user.

A

Scanner

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following is not a valid Java primitive type?

double
char
byte
real

A

real

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Attributes of a class are known as

A

Local Variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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

A

JOptionPane

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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!” );

A

The porridge is too hot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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!” );

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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
A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly