Comp Sci Java Test
Evaluate the following: 3.75 / 2.5
1.5
What is the ASCII value of 'A'
65
What is the output by the code: System.out.println(3+6);
9
A complier converts object code into machine code: True or False
True
Assignment operator changes a value of an object by moving a new value to the storage location: True or False
True
Many programmers pick up the bad habit of not completing planning steps before starting to code: True or False
True
Which of the following is not a computer application: Adobe Photoshop iTunes Windows 7 Operating System
Windows 7 Operating System
Which of the following would print a backslash on the screen is used in a print() or println(): \\\ \\ ^
\\
Which of the following is a new line character: \\ \n "
\n
What is the output by the code: System "a\tc");
a c -- because \t is tab
What is a method
a tool that helps organize a program
Who usually creates test data
the programmer
Which of the following types uses the least amount of memory: int long char double
char
What is the output by the code: System.out.print("dc\\dc");
dc\dc -- because \\ is \
What is the output by the code: System.out.print("abc";
error -- because there is no parenthesis after the second "
Which of the following Scanner methods can be used to read in a double: nextFloat(); nextDouble(); next();
nextDouble();
Which of the following methods is used to read in a line of words: nextLine(); next(); nextDouble();
nextLine();
What is the output of the code: public static void main(String args[]} { }
nothing
Every method must have an open and closed what
parenthesis
Which of the following methods would move the cursor down to the next line: print(); printLn(); printLINE(); println();
println();
The _____ contains the programmers original program code
source file
Never put a semicolon before an open what
bracket
What is the ASCII value of 'b'
98
Evaluate the following: 3 + 3 * 7 / 2
13
What is the output by the code: System.out.println(3+ " " +3);
3 3 -- because it is 3 + space +3
What is the output by the code: int x = 9; double y = x; System.out.println(y);
9.0
What is the output of the code: String s = "abcdef"; Sytstem.out.println(s);
abcdef
Which of the following lines correctly defines an integer variable: integer i = 234; i = 234; integer = 234; int i = 234;
int i = 234; -- its int not integer
What is not a legal reserved word for a java data type
integer -- its int
Which of the following is a valid identifier (variable name): 123java main (java java1234
java234 -- can't start with a number, special character, or reserved word
Within the Java industry, most all variable names are lower case: True or False
True
The ability to create methods in a programming language is of minor importance: True or False
False
What is the output by the code: System.out.println("\"9");
"9 -- because \" means double quote
Which of the following can be used to comment code in java
/* and //
In java, every program statement ends with a what
;
IDE means Integer Division Expression
False
Pseudocode is the only commonly used planning tool for programming: True or False
False
Reserved words are allowed to be used as identifier names in some programming languages: True or False
False
Identifier names should be meaningful: True or False
True
Which of the following lines correctly defines a char variable: char = 'c'; char d = 'c'; char = c
char d = 'c';
Given the statement, var must be which type? var = keyboard.nextDouble();
double
Which of the following is a 64 bit data type
double
Which of the following types uses the most memory: int char float double
double
Which of the following correctly defines a double variable: double d = 251.5 double = 251.5 double d = 251.5;
double d = 251.5;
Evaluate the following: 4 + 5 * %2
error