1/39
Flashcard deck covering Java syntax, print output, variable declarations, data types, ASCII values, and formatting rules based on the A+ Computer Science review test.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is the output of the statement System.out.print("abc");?
abc
What is the output of the statement System.out.print("a\tc");?
a c
What is the output of the code block public static void main( String args[ ] ) { }?
no output
What is the output of the statement System.out.print("ab\ab");?
ab\ab
Which of the following is not a legal reserved word for a Java data type: double, integer, float, char, or byte?
integer
What is the output of String s = "abcdef"; System.out.println(s);?
abcdef
In Java, every program statement ends with what symbol?
;
Which of the following is a valid identifier in Java: 123java, main, java1234, or {abce?
java1234
Which of the following can be used to comment code in Java?
//
Which of the following is a 32-bit data type in Java: char, long, double, or int?
int
What is the output of System.out.println(3 + " " + 3);?
3 3
What is the output of System.out.println(3 + 6);?
9
What is the output of System.out.println("\"9");?
"9
Which of the following lines correctly defines a String variable in Java?
String s = "cdef";
Which of the following lines correctly defines an int variable in Java?
int i = 234;
Which of the following lines correctly defines a double variable in Java?
double d = 234.1;
Which of the following lines correctly defines a char variable in Java?
char c = 'a';
Which of the following data types uses the most memory: double, int, float, char, or byte?
double
Which of the following data types uses the least memory: int, double, char, float, or long?
char
In Java programming, you should never put a semicolon before an open what?
brace
Which method would move the cursor down to the next line when printing in Java?
println()
Every method in Java must have an open and close what?
brace
Which sequence is the newline character in Java?
\n
Which sequence is the tab character in Java?
\t
Which sequence would print one backslash on the screen if used in a print() or println() method?
\
What is the output of int aNum = 9; double bNum = aNum; System.out.println(bNum);?
9.0
What is the output of double cNum = 9.0; int dNum = cNum; System.out.println(dNum);?
none - error
What is the ASCII value of 'b'?
98
What is the ASCII value of 'B'?
66
What is the output of char c = 65; System.out.println(c);?
A
Which of the following is a 16-bit unsigned data type in Java: byte, short, char, long, or float?
char
Which of the following is an 8-bit data type in Java: byte, short, char, long, or float?
byte
Which of the following is a signed 16-bit data type in Java: byte, short, char, long, or float?
short
What is the output of double eNum = 'A'; System.out.println(eNum);?
65.0
What is the output of int fNum = 'A'; System.out.println(fNum);?
65
What is the output of int wNum = 'a' + 2; System.out.println(wNum);?
99
What is the output of float gNum = 9.2; System.out.println(gNum);?
error
What is the output of double hNum = 9.2f; System.out.println(hNum);?
9.2
Which data type could fill
int
Which data type could fill
double