OLD EXAMS
These exams (first midterm, second midterm, and final) were used in previous quarters. You may see some of the same questions on your exam. Material coverage may be different and your exam will likely be harder.
CPTR/INF 201Programming with Java
1st MIDTERM EXAM
. Who developed the Java language
a. Microsoft
@ b. Sun Microsystems
c. Intel
d. Ohio State University
e. none of the above
. Netscape was first to license JavaScript for its browser.
@ a. TRUE
b. FALSE
. Which unit is responsible for performing calculations
a. primary storage unit
b. secondary storage unit
@ c. Arithmatic/logic unit
d. backup units
e. delta units
. Multiprogramming
a. involves two programmers working on the same program.
b. two computers executing the same program.
@ c. one computer executing more than one program at the same time
. Any computer can directly understand only its own machine language.
@ a. TRUE
b. FALSE
. Machine language is the natural language of a particular computer.
@ a. TRUE
b. FALSE
. To speed up the programming process, high level languages were
developed.
@ a. TRUE
b. FALSE
. Translator programs that convert high level language programs into
machine language are called compilers.
@ a. TRUE
b. FALSE
. Which is not a high level language
a. Java
b. COBOL
c. BASIC
@ d. Assembly
e. FORTRAN
. A line which begins with // is
a. an instruction to the browser
@ b. a comment, ignored by the system
c. a compiler directive
. Which is not equal
a. >
b. <
@ c. !=
d. ==
e. none of the above
. Which is less than
a. >
@ b. <
c. !=
d. ==
e. none of the above
. An IF statement nust have a conditional expression which
a. will give the URL
b. tell the system which language is being used
@ c. will be true or false
. The WHILE statement has a conditional expression.
@ a. TRUE
b. FALSE
. Which operator means and
@ a. &
b. |
c. !
d. ==
e. none of the above
. Which operator means not
a. &
b. |
@ c. !
d. ==
e. none of the above
. document.writeln('CIS is great'); this statement will
a. print a message to the title bar of the browser
@ b. print a message to the browser
c. send a message to the server
. empname = prompt('enter an employee name',''); this statement will
a. print a message to the title bar of the browser
b. print a message to the browser
c. send a message to the server
@ d. display a dialog box so the user can input same data
. braces are used to
@ a. block statements together
b. define what is on the screen
c. open and close windows
. Using JavaScript can enables a web page to open a new browser window.
@ a. TRUE
b. FALSE
. Only one statement can be executed if the conditional expression in an
IF statement is true.
a. TRUE
@ b. FALSE
. It is possible thru the navigator object to access the name of the
browser being used (ie: Microsoft Internet Explorer)
@ a. TRUE
b. FALSE
. It is possible to access the date with JavaScript.
@ a. TRUE
b. FALSE
2nd MIDTERM EXAM
. Debugging statements show intermediate results when developing code.
@ a. TRUE
b. FALSE
. window.status = 'CIS 201' will print CIS 201
a. at the top of the window
@ b. at the bottom of the window
. document.writeln(navigator.appName); could display
a. the IP address
b. the URL
@ c. Microsoft Internet Explorer
d. the connection speed
. Lab 4 searches for the correct tax bracket. The search is
a. binary
@ b. sequential
c. recursive
d. multi pass
. Which is not equal
a. <=
b. >=
c. ==
@ d. !=
. What is the output of the following statement when A is equal to 0.
if (a = 0)
{
document.writeln('Hello ');
document.writeln('World ');
}
a. Hello
@ b. Hello World
c. World
. When more than one statement is needed inside a loop
a. [ ] are used
b. ( ) are used
@ c. { } are used
d. < > are used
e. / \ are used
. Consider the sample program.
Which lines of code are nested
a. 61, 62
b. 22, 23
@ c. 13, 14
d. 28, 29
e. 37, 38
. Consider the sample program.
Which line of code begins the execution of the program
a. 11
b. 13
@ c. 49
d. 66
. Consider the sample program.
Which lines of code will switch 2 elements of an array
a. 34, 35
@ b. 21 - 23
c. 40 - 44
. A binary search of an array must have all elements of the array in
sorted order.
@ a. TRUE
b. FALSE
. A sequential or linear search of an array need not have the array
elements in order.
@ a. TRUE
b. FALSE
. Consider the sample program. In the function binarySearch the two if
statements are nested.
@ a. TRUE
b. FALSE
. Consider for (x = 0; x < 10; x++) x++ is the same as
a. x = x + 2
@ b. x = x + 1
c. x = x + x
d. x = x + x + x
. The statement bubbleSort(); starts executing statements in the
function bubbleSort(), then returns to execute the next statement.
@ a. TRUE
b. FALSE
. Consider the sample program. If the key is not found, it is added to
the array.
a. TRUE
@ b. FALSE
. Will the following two program fragments display the same result
for (x = 0; x < 10; x++) document.writeln(x);
----------
x = 0;
while (x < 10)
{
document.writeln(x);
x = x + 1;
}
@ a. TRUE
b. FALSE
. while (expression)
a. expression must contain a constant
@ b. expression is either true or false
c. expression must contain an relational operator
. Which is and
a. |
@ b. &
c. !
. Which is or
@ a. |
b. &
c. !
. Which is not equal
a. |
b. &&
@ c. !=
. Methods in Java are functions in javaScript.
@ a. TRUE
b. FALSE
. The position number in the brackets of an array is called the
subscript or index.
@ a. TRUE
b. FALSE
. If an array is called ztable, then ztable.length tells us
a. the type of array
@ b. the number of elements
c. digits of precision
. Consider the sample program. lines 29 and 30 are nested.
a. TRUE
@ b. FALSE
. Arrays in Java and javaScript start with element 0. So,
tab = new Array(5) has elements 0, 1, 2, 3, 4.
@ a. TRUE
b. FALSE
. In javaScript an array can be defined without stating the number of
elements. The array usage will determine the number of elements.
@ a. TRUE
b. FALSE
. Which is more efficient
a. linear search
@ b. binary search
FINAL EXAM
. Leaving a cookie is normally done by
a. java, compiled, running in an MS DOS windows
@ b. javascript running in a web browser
. File IO, not counting cookies is normally done by
@ a. java, compiled, running in MS Windows
b. javascript running in a web browser
. The for statement is identical in javascript and java.
@ a. TRUE
b. FALSE
. The if statement has a conditional expression in javascript and
java.
@ a. TRUE
b. FALSE
. HTML statement are allowed in java, compiled, running in a MS DOS
window.
a. TRUE
@ b. FALSE
. Variables must be declared in
a. javascript
@ b. java
. A javascript function can be called by a HTML statement.
@ a. TRUE
b. FALSE
. Forms are used in
a. java
@ b. javascript
.
a. "BUTTON" is not a legal input type
b. "BUTTON" is on the keyboard
@ c. "UpdateCookie()" is a function
. double fedtable [] [] = new double [3] [3];
a. fedtable is a one dimension table
@ b. fedtable is a two dimension table
c. fedtable is a three dimension table
d. cannot tell from the statement
. Taxfile in lab 6
a. could be read in Notepad, the numbers were base 10
@ b. could be opened in Notepad, but was garbage, the numbers were
binary
. javax.swing.* gives the program access to file IO routines.
a. TRUE
@ b. FALSE
. java.io.* gives the program access to file IO routines.
@ a. TRUE
b. FALSE
. javax.swing.* gives the program access to
a. cookies on the user's PC
b. other PCs on the network
@ c. OS user interface tools like an input dialog box
d. URLs
. for statement are not allowed in compiled java.
a. TRUE
@ b. FALSE
. for (i=0;i<10;i++) could be used for both java and javascript.
@ a. TRUE
b. FALSE
. Arrays can be initialized with values in the statement that defines
the array in java and javascript.
@ a. TRUE
b. FALSE
. Two dimension arrays are not allowed in java
a. TRUE
@ b. FALSE
. Lab 6 & 7 used the java compiler not an interpreter.
@ a. TRUE
b. FALSE
. In lab assignment, forms were used in
a. java
@ b. javascript
c. javasync
d. javabin
e. sdk
. Consider the sample program. Line 11 will
a. read in data
b. display a user dialog box
c. display a message box
@ d. define an array
. Consider the sample program. Lines 27,28 will
a. read in data
@ b. display a user dialog box
c. display a message box
d. define an array
. Consider the sample program. Lines 41,42 will
a. read in data
b. display a user dialog box
@ c. display a message box
d. define an array
. Consider the sample program. Line 18 will
@ a. read in data
b. display a user dialog box
c. display a message box
d. define an array
. Consider the sample program. Lines 12,13 will
a. read in data
b. display a user dialog box
c. display a message box
@ d. define variables