stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java Midterm Review Flashcards | StudBud
Explore
/
Java Midterm Review
Java Midterm Review
49 terms
·
StudBud Administration
·
42 plays
This will give us an in-depth review of the CS 1400 Java midterm. #java
Flashcards
49 cards
F
Practice quiz
P
Host live
L
Questions
49
Answers
1
What is an assignment statement?
Assigning a value to a variable
Assigning a name to a variable
Adding a number to an int
Assigning a multiplication
2
The following code will result in: int num = 6.7;
Runtime error
num being 6
Compilation error
num being 6.7
3
Choose the appropriate data type for this variable: kindOfBird
char
int
String
double
4
Which of the following always need a capital letter?
Data types and fields
Objects and class names
Fields and Strings
Class names and the String type
5
Java _________the program first and then __________it.
interpret and compile
compile and interpret
assemble and debug
compile and assemble
6
java is a(n) _____________language.
procedural oriented
object oriented
platform oriented
system oriented
7
What is “num” after the following statements? int num; num = (5+4); num = num / 9; num = 9;
9
1
Num
0
8
What is the role of the constructor?
Create names for methods
To create some type of change in the state of an object
Create an instance of a class (an object)
9
Which operation(s) is/are required to convert the java source code into output form.
interpretation
compilation
none of these
both compilation & interpretation
10
What will be the value of myDouble after the following code executes: double myDouble = 3;
Runtime error
Compilation error
3
3.0
11
Choose the appropriate data type for this value: 1
double
String
boolean
int
12
What is essential in making sure that your loop is not infinite?
All of the choices
That your Boolean statement will at some point be true
That your Boolean statement will at some point be false
That there is a Boolean statement somewhere in your code
13
What is the proper way to declare a variable?
variableType;
variableName;
variableName variableType;
variableType variableName ;
14
What is the keyword used in java to create an object?
new
new()
this
sync
15
Java keywords are written in lowercase as well as uppercase.
False
True
16
Which of the following is a Java keyword?
Integer
String
try
main
17
What is JDK?
Java Demo Kit
Java Development Kit
Java Distributed Kit
Java Deployment Kit
18
What is the main function of any variable?
To write Java code
To keep track of data in the memory of the computer
To print words to the screen
To add numbers together
19
Choose the appropriate data type for this field: weightInKilos
int
char
String
double
20
What does GUI stand for?
Gimme Ur Internet
Grand User Interface
Graphical User Interface
Graphical Useful Interface
21
Is java 100% object oriented language?
yes
nope, it's coffe
not sure
no
22
What does JRE mean?
java runtime execution
none of these
java runtime environment
java runtime exception
23
Which is NOT a section of all types of loops?
Loop Body
Initialization
Test statement
The word "while"
24
The following code will result in: float num = 5/0;
Runtime Exception
Compilation error: Divisions must be in a try block
No Error: a is NaN
Compilation error: DivideByZeroException
25
Generally, a class cannot be declared:
public
private
static
26
In a 'for' loop, what section of the loop is not included in the parentheses after ‘for’?
Update
Test Statement
Initialization
Loop Body
27
An abstract class can have non-abstract methods.
False
True
28
Integer a = new Integer(2); Integer b = new Integer(2); What happens when you do if (a==b)?
Compilation Error
True
Runtime Exception
False
29
Choose the appropriate data type for this variable: isSwimmer
String
boolean
double
int
30
What's the difference between an Applet and an application?
An application is only available on Windows.
Applets are run over the web.
Applets can paint words, applications cannot.
None of these.
31
An object could be ...
A program
Anything that can be described with nouns and adjectives
An algorithm
A data container
32
Which means to be true, either x must be less than 3 or y must be greater than or equal to 4 ?
if ((x > 3) || (y <= 4))
if ((x < 3) || (y >= 4))
if ((x < 3) && (y > 4))
if (x < 3 y >= 4)
33
Choose the best definition of an object
An instance of a class
Something you wear
A thing
34
The following code will produce: int num = 8/0;
Compilation error: DivideByZeroException
No Error: a is NaN
Runtime Exception
Compilation error: Divisions must be in a try block
35
Choose the appropriate data type for this value: "1"
int
boolean
String
char
36
In order to run/develop a Java program, we need to install __________application program.
sdk
jdk
dbk
none of these
37
What is the size of a char in Java?
8 bits
7 bits
16 bits
4 bits
38
Methods that are marked protected can be called in any subclass of that class.
False
True
39
What is the correct syntax for java main method?
None of these
public static void main(string[] args)
public static void main()
public void main(String[] args)
40
The following code will produce:
Compilation error
Output of x is 1
Runtime Error
Runtime Exception
41
Object-Oriented Programming means ...
Designing based on objects found when analysing the problem
Writing an algorithm first and having a test plan
Being objective about what you develop
Writing a program composed of Java classes
42
What is a loop?
A segment of code to be run once
A segment of code to be run a specified amount of times
A segment of code to be run infinite times
A new type of Applet
43
Choose the appropriate data type for this field: numberOfEggs
char
double
int
boolean
44
For your conditional to depend on two conditions BOTH being true, what is the proper notation?
&
&&
||
|
45
What is the difference between private and public functions/methods?
Public functions are the only ones you can download
Public functions are free, you have to buy private ones
Public functions can't be used
Public is used by anyone, private is only in the same class
46
Choose the appropriate data type for this value: true
boolean
double
String
int
47
Will the conditional execute:
Yes, the strings are equal.
No, the strings are not equal.
48
Java can run on _______.
Unix/Linux
Windows
All of these
Mac
49
Choose the appropriate data type for this value: "volatile"
double
int
char
String