Midterm Exam Flashcards
When you create a block, you must place multiple statements within it.
False
Which of the following is NOT a component of a variable declaration statement?
a.
variable name
b.
ending semicolon
c.
data type identifier
d.
symbolic constant
symbolic constant
Although not a requirement, it is Java standard that class identifiers begin with an uppercase letter and use other uppercase letters to improve readability.
True
The executable file that executes a Java bytecode into a machine code:
Select one:
a.
javax
b.
java
c.
javaw
d.
javah
e.
appletviewer
f.
javac
java
Modulus operator, %, can be applied to which of these?
Select one:
a.
Both Integers and floating
b.
None of the mentioned
c.
Integers
d.
Floating
Both Integers and floating
A ____ is a named memory location that you can use to store a value
a.
primitive
b.
reference
c.
variable
d.
cast
variable
Java methods must be located inside a class.
True
Although not required, it is common procedure to align the keyword if with the keyword else.
True
Which of these is returned by greater than,
Boolean
The literals 5, 23, -2, and 900 are integer literals in Java and are of automatic type long.
False’.
Which of these statement is correct?
Select one:
a.
true and false are non numeric values.
b.
true is any non zero value and false is 0.
c.
true and false are numeric values 1 and 0.
d.
true and false are numeric values 0 and 1.
true and false are non numeric values.
What is the operand of arithmetic operators?
Select one:
a.
Numeric
b.
Both Numeric & Characters
c.
Characters
d.
Boolean
Both Numeric & Characters
All Java statements are terminated with a semicolon.
True
A loop that never ends is called a(n) ____ loop.
a.
while
b.
for
c.
infinite
d.
definite
infinite
Which of these is necessary condition for automatic type conversion in Java?
Select one:
a.
None of the mentioned
b.
The destination type is smaller than source type.
c.
The destination type is larger than source type.
d.
The destination type can be larger or smaller than source type.
The destination type is larger than source type.
____ occurs when both of the operands are integers.
Unlike assignment
b.
Integer division
c.
Data modeling
d.
Type cast
Integer division
Classes and methods are always defined in blocks of code enclosed in {}.
True
In the switch structure, break is followed by one of the possible values for the test expression and a colon.
False
A variable can hold more than one value at a time.
False’.
When you place a block within an if statement, it is crucial to place the ____ correctly.
a.
commas
b.
periods
c.
curly braces
d.
angle brackets
curly braces
When an expression containing a ____ is part of an if statement, the assignment is illegal.
a.
Boolean value
b.
double equal sign
c.
single equal sign
d.
greater than sign
single equal sign
Local variables are variables that are declared inside the class but outside the method.
False’.
A compiler ignores whitespace (that is, any combination of nonprinting characters) between words and lines.
‘True’.
true && false || 9 < 4 + 5
False’.
In Java, when a numeric variable is concatenated to a String using the ____, the entire expression becomes a String.
a.
plus sign
b.
equal sign
c.
concatenate statement
d.
string statement
plus sign
The ____ operator is always evaluated before the OR operator.
a.
AND
b.
Assignment
c.
Logical
d.
Conditional
AND
JDK stands for Java _____ Kit.
Select one:
a.
Distinct
b.
Distributed
c.
Design
d.
Development
Development
Why is the main() method special in a Java program?
Select one:
a. Every class must have a main() method.
b. The main() method must be the only static method in a program.
c.
Only the main() method may create objects.
d.
It is where the Java interpreter starts the whole program running.
It is where the Java interpreter starts the whole program running.
The compiler does not take indentation into account when compiling code, but consistent indentation can help readers understand a program’s ____.
a.
decision
b.
machine language
c.
logic
d.
class
logic
What is the size of a double variable in Java?
Select one:
a.
2 bytes
b.
8 bytes
c.
It depends on the compiler setting
d.
It depends on the operating system
e.
4 bytes
8 bytes
A logical structure called a(n) ____ structure is when one step follows another unconditionally.
a.
decision
b.
straight
c.
unconditional
d.
sequence
sequence
What is the output of this program? class conversion { public static void main(String args[]) { double a = 295.04; int b = 300; byte c = (byte) a; byte d = (byte) b; System.out.println(c + " " + d); } }
Select one:
a.
39 44
b.
295 300
c.
38 43
d.
295.04 300
295 300
IDE stands for _____ Development Environment.
Select one:
a.
Integrated
b.
Integral
c.
Instantiated
d.
Interface
Integrated
The extension used for a java source file is .class.
False’.
Short is an object data type in Java.
‘True’.
You use the NOT operator, which is written as the exclamation point (!), to negate the result of any Boolean expression.
True’.
The byte and short data types occupy less memory and can hold only smaller values.
‘True’.
API stands for _____ Programming Interface.
Select one:
a.
Application
b.
Asynchronous
c.
Amplified
d.
Advanced
Application
The kinds of loops based on behavior:
Select one:
a.
Linear, Matrix, Multi-Dimensional
b.
Class, Method, Statement
c.
while, do while, for
d.
Counting, Sentinel-Controlled, Result-Controlled
Counting, Sentinel-Controlled, Result-Controlled
You use the ____ data type to hold any single character.
a.
char
b.
byte
c.
single
d.
float
char