stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java Last Review Flashcards | StudBud
Explore
/
Java Last Review
Java Last Review
50 terms
·
StudBud Administration
·
83 plays
A last review for summer Java course
Flashcards
50 cards
F
Practice quiz
P
Host live
L
Questions
50
Answers
1
Which of the following declares a variable that will store a welcome message?
Char Welcome
String welcome
Double welcome
Int Welcome
2
Which is a valid comment?
&&
/
"
//
3
Which operator is used to concatenate two or more strings?
==
)
%
+
4
Which loop executes first?
while do
while
for
do while
5
Java is a ______ programming language
Long form
Object oriented
Spacing dependent
Spaghetti style
6
Methods live inside
classes
objects and classes
variables
objects
7
What is a storage location in the computer's memory called that has a type and name?
Int
Method
Variable
Char
8
Which of the following is not contained on the motherboard of a computer?
RAM
CPU
integrated circuit
hard disk
9
Name of the type that denotes floating-point numbers that can have fractional parts/
String
Double
Int
Float
10
Which of the following guidelines will make code more explanatory for others?
Avoid usage of complex calculations in source code.
Use more statements in source code.
Add comments to your code
Always nest your braces properly
11
Which statement best describes a computer program?
A sequence of comments.
A program can only perform one simple task.
A program can decide what task it is to perform.
A sequence of instructions and decisions.
12
Which statement declares and stores an integer value in a variable?
inter count = 5;
integer count = 5;
int count = 5;
count = 5;
13
What is the output of the following Java statement?System.out.println(4 + 6);
10
4
4 + 6
6
14
What does an object store its data in?
files
methods
instance variables
class variables
15
Which is the Java equivalent of the following mathematical expression?c = 2 pi *radius
c = 2 * Math.PI * radius;
c = 2 * Math.PI * radius * 2;
c = 2 * Math.PI * Math.pow(radius, 2);
c = 2 * Math.PI * Math.pow(2, radius);
16
Which is not a loop we have studied
Do
for
do while
Switch
17
The operator !> stands for
Not equal to
Not less than
Not greater than
Not a real Java operator
18
A set of values and the operations that can be carried out with those values are called
numbers
literals
types
values
19
What term is used to refer to an instruction in a method?
statement
constant
final
static
20
By convention, variables begin with a(n)
lower case number
underscore
uppercase letter
lower case letter
21
Which of the following statements is true about the if statement?
The if block is optional.
It can have only one condition that with an integer value.
The else block is optional.
The if and else blocks should always be in curly braces.
22
What are the two parts of an if statement?
A condition and a body
A condition and an increment
A condition and methods
A condition and a decriment
23
Which of the following cannot be nested
Loops
Loops and ifs together
If
Constants
24
You should declare all instance variables as ?
final
static
private
public
25
An algorithm is
A way of looking at a problem
Not that important
The code itself
a step by step for the best solution to the problem
26
Which of the following statements is correct about constants?
Constant variables can only be changed with Math library.
You can make a variable constant by usingfinal
The data stored inside a constant can be changed
Constants are written using capital letters
27
Which of the following values does not have a primitive type?
Char
String
Double
Int
28
Which statement is true about : System.out.println("Welcome!");
There are multiple errors.
There is a run-time error.
There are no errors.
There is a compile-time error.
29
Private instance variables
can only be accessed by all methods
can only be accessed by methods of the same class
can only be accessed by no methods
can only be accessed by methods of a different class
30
What is the name of the type that denotes a string of characters?
StringChar
String
Char
Characters
31
What does CPU stand for?
Central Processing Unit
Computer Programming Unit
Central Programming Unit
Computer Processing Unit
32
== does what
Compares two values
Says not to compare two values
Sets a variables value
Trick question professor, it does both 1 and 2
33
You should use a loop...
When it supports the best algorithm
When it makes the best senses
When you dont have any other choices
Whenever you can
34
Every Java program consists of one or more of these fundamental building blocks.
Method
Class
Applet
Language
35
What translates Java source code into files that contain instructions for the JVM?
linker
interpretuer
compiler
assembler
36
In Java, every statement must end with this symbol.
;
.
:
//
37
When a Java application starts, what is the name of the method that is executed?
name
alt
main
void
38
A loop tests a
Variable
Result
User input
Condition
39
Which loop checks conditions first
For
Do while
While
Do
40
A loop with no end is called
An illegal loop
A recursive loop
An illogical loop
An infinite loop
41
What is the JVM?
A virtual machine that compiles Java code.
A virtual machine that runs compiled Java code on any CPU.
A vital machine that compiles Java code.
A vital machine that never fails to run compiled Java code.
42
Which does a loop not always do?
Execute code
Give the use a choice
Contain curly braces
Test a condition
43
What is the name of the type that denotes whole numbers?
Int
Double
Whole
While
44
A __________ contains sequences of instructions to perform a particular task.
parameter
comment
variable
method
45
What is the return type of a constructor?
Static
Public
Trick Question Professor Gatto!
Void
46
Which of the following options declares a float variable?
age: float =5;
Float age;
float age;
Flt age;
47
Which type of storage is made from memory chips?
DVD
CD
hard disk
primary storage
48
Constant variables can only be changed through the Math library.
6.0
9.0
6.9
3.0
49
What is the syntax for calling the println method on the object System.out?
println(System.out, "Any message");
println("Any message").System.out;
System.out("Any message").println;
System.out.println("Any message");
50
The name of the constructor is always the same as the name of the
method
object
variable
class