Name:     ID: 
 
Email: 

CS_P_Final2016

Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

 1. 

Java is a modern ____ programming language.
a.
first-generation
c.
procedural
b.
object-oriented
d.
second-generation
 

 2. 

A(n) ____ user interface uses the Java console and the command prompt to display data, prompt the user for data, and read data into a program.
a.
terminal I/O
c.
graphical
b.
text
d.
illustrative
 

 3. 

The end of a statement in a Java program is denoted by a ____.
a.
:
c.
;
b.
.
d.
}
 

 4. 

*Which of the following Java statements would print the text “Hello” in a terminal window?
a.
System.println(“Hello”);
c.
System.printLine(“Hello”);
b.
System.out.println(Hello);
d.
System.out.println(“Hello”);
 

 5. 

Using a simple text editor in Windows to write Java programs, plus running the Java compiler and the JVM from the command line in Windows is known as the ____ development environment.
a.
simple
c.
integrated
b.
DOS
d.
Windows
 

 6. 

The assignment operator is represented in Java by the symbol ____.
a.
>
c.
==
b.
=
d.
!=
 

 7. 

____ errors occur when a program asks the computer to do something that it considers illegal, such as dividing by 0.
a.
Logic
c.
Syntax
b.
System
d.
Run-time
 

 8. 

Adding extra lines of code to a program that print the values of selected variables in the terminal window in order to identify a logic error is an example of a(n) ____ technique.
a.
desk checking
c.
debugging
b.
compiling
d.
instantiating
 

 9. 

The ____ class contains a number of methods that can be used to perform common mathematical operations, such as calculate a square root.
a.
Mathematical
c.
Random
b.
Arithmetic
d.
Math
 

 10. 

The condition in an if statement must be a(n) ____ expression.
a.
Integer
c.
Arithmetic
b.
String
d.
Boolean
 

 11. 

The equal-to (comparison) operator is represented by the symbol ____.
a.
=
c.
!=
b.
==
d.
===
 

 12. 

*Which of the following code snippets would display the square roots of 25, 20, 15, and 10?
a.
int number = 25;
while (number > 10){
     System.out.println ("The square root of " +
          number + " is " + Math.sqrt (number));
     number -= 5;
}
b.
int number = 25;
while (number <= 10){
     System.out.println ("The square root of " +
          number + " is " + Math.sqrt (number));
     number--;
}
c.
int number = 25;
while (number >= 10){
     System.out.println ("The square root of " +
          number + " is " + Math.sqrt (number));
     number -= 5;
}
d.
int number = 25;
while (number >= 10){
     System.out.println ("The square root of " +
          number + " is " + Math.sqrt (number));
     number--;
}
 

 13. 

Which of the following represents the proper structure of a for loop?
a.
for (initialize counter; update counter) {
    statement;
    statement;
     . . .;
}
b.
for (initialize counter; test counter; update counter) {
    statement;
    statement;
     . . .;
}
c.
for (update counter; initialize counter; test counter ) {
    statement;
    statement;
     . . .;
}
d.
for (test counter; initialize counter; update counter) {
    statement;
    statement;
     . . .;
}
 

 14. 

Java’s AND operator is represented by the symbol ____.
a.
$$
c.
||
b.
!
d.
&&
 

 15. 

Java’s OR operator is represented by the symbol ____.
a.
||
c.
&&
b.
!
d.
~
 

 16. 

Which of the following operators has the highest precedence?
a.
&&
c.
!
b.
||
d.
*
 

 17. 

*Assuming p, q, and r are Boolean variables, the expression p || (q && r) is equivalent to ____.
a.
(p && q) || (p && r)
c.
(p || q) && (p || r)
b.
(p && !q) || (p && !r)
d.
(p || !q) && (p || !r)
 

 18. 

*Consider the following code fragment:

   if (x > 5 )
        if ( y < 10 )
            System.out.print(“1”);
            System.out.print(“2”);
        else
            System.out.print(“3”);

Assuming that x has a value of 10 and y has a value of 5, the output of this code fragment would be ____.
a.
1
c.
12
b.
3
d.
Nothing. The code would not compile.
 

 19. 

*Consider the following code fragment:

   if (sales >= 5000)
        commission = sales * 1;
    else if (sales >= 10000)
        commission = sales * 2;
    else if ( sales >= 15000 )
        commission = sales * 3;
  
If sales has a value of 15,000, what will the final value of commission be?
a.
5000
c.
30,000
b.
15,000
d.
45,000
 

 20. 

When specifying colors in an HTML document, the string ____ indicates black, a total absence of any color, whereas ____ represents white, a total saturation of all colors.
a.
“#FFFFFF”; “#000000”
c.
“#000000”; “#FFFFFF”
b.
“#999999”; “#000000”
d.
“#000000”; “#999999”
 

 21. 

An array index must appear within the symbols ____.
a.
[ ]
c.
( )
b.
{ }
d.
< >
 

 22. 

Which of the following would correctly declare an array of 500 integers named abc?
a.
int[] abc = int[500];
c.
int[] abc = new int[499];
b.
int abc = new int[500];
d.
int[] abc = new int[500];
 

 23. 

*Which of the following loops would correctly sum the elements of an array of 500 integers named abc?
a.
int sum = 0;
for (int i = 1; i < 500; i++)
    sum += abc[i];
b.
int sum = 0;
for (int i = 0; i <= 500; i++)
    sum += abc[i];
c.
int sum = 0;
for (int i = 0; i < 500; i++)
    sum += abc[i];
d.
int sum = 0;
for (int i = 0; i < 500; i++)
    abc[i] += sum;
 

 24. 

 Digital data can be __________ that have been converted into discrete digits such as 0s and 1s.?
   
a.
text
b.
numbers
c.
graphics, sound, and video
d.
all of the above?
 

 25. 

The process of converting information, such as text, numbers, photos, or music, into digital data that can be manipulated by electronic devices is called ___________.?
a.
binary
b.
digitization
c.
representation?
d.
none of the above
 

 26. 

ASCII requires __________ bits for each character.?
a.
two
b.
six
c.
seven
d.
ten
 

 27. 

. Sampling _______ refers to the number of times per second that a sound is measured during the recording process
a.
rate
b.
depth
c.
sound
d.
compression
 

 28. 

. Digital audio is stored in a variety of file formats, including ___________.?
a.
WMA
b.
WAVE
c.
MP3
d.
All of the above
 

 29. 

. Which of the following is NOT a type of bitmap format??
a.
TIFF
b.
RAW
c.
PNG
d.
Zip
 

 30. 

Today’s color display devices represent color using the ______ color mode
a.
GGB
b.
PNG
c.
BMP
d.
non of the above
 

 31. 

Which type of network topology connects a peripheral device to a host device??
a.
Mesh
b.
Star
c.
Buss
d.
point to point
 

 32. 

On a network, which protocol is responsible for dividing files into chunks, adding headers containing information for reassembling packets in their original order, and error checking??
a.
UDP
b.
IP
c.
TCP
d.
FTP
 

 33. 

DSL is an example of what type of Internet access??
a.
Mobile
b.
Portable
c.
Fixed
d.
Wireless
 

 34. 

. __________ LANs are usually arranged in a star topology with computers wired to central switching circuitry that is incorporated in modern routers.?
a.
Internet
b.
Ethernet
c.
Wireless
d.
Mobile
 

 35. 

The World Wide Web is a collection of HTML documents, images, videos, and sound files that can be linked to each other and accessed over the Internet using a protocol called _____.?
a.
HTTP
b.
FTP
c.
IP
d.
HTML
 

 36. 

Most computers have temporary holding areas called __________.?
a.
output
b.
microprocessor
c.
CPU
d.
memory
 

 37. 

The decimal equivlant to the binary nunber   1111    is
a.
19
b.
15
c.
22
d.
40
 

 38. 

The decimal equivlant to the hex nunber  80   is
a.
128
b.
256
c.
500
d.
101
 

 39. 

*assume values is an int array that is currently filled to capacity, with the following values:
[9 4 12 2 6 8 18]

What is returned by values[3]?
a.
9
b.
12
c.
6
d.
2
 

 40. 

*assume values is an int array that is currently filled to capacity, with the following values:
[9 4 12 2 6 8 18]

The statement System.out.println(values[7]); will
a.
8
b.
18
c.
9
d.
error
 



 
         Start Over