CC 12 Midterms Flashcards
(25 cards)
The Java if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not.
True or False
True
If we want to do something else when if the condition is false, then we use the else statement.
True or False
True
Java while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean Condition.
True or False
True
The for statement consumes the initialization, condition and increment/decrement in one line thereby providing a shorter, easy to debug structure of looping.
True or False
True
do-while Loop checks for the condition before executing the statements or the loop body.
True or False
False
You may be writing a program where you want to evaluate multiple statements and execute code depending on which statement (if any) evaluates to true. That’s where the if statement comes in.
True or False
False
Nested if condition means an if statement within an if statement.
True or False
True
Normally, statements in a program are executed one after the other in the order in which they’re written. This process is called sequential execution.
True or False
True
In programming also face some situations where we want a certain block of code to be executed when some condition is fulfilled. This is repetition structures.
True or False
False
Looping in programming languages is a feature which facilitates the execution of a set of instructions/functions while some condition evaluates to true.
True or False
False
It is accessible within the class in which it is defined and in its subclass?
A. protected
B. default
C. public
D. private
A. protected
Which of these is an incorrect array declaration?
A. int [] arr = new int[5]
B. int arr[] = new int[5]
C. int arr[] = int [5] new
D. int arr[]
arr = new int[5]
C. int arr[] = int [5] new
What is the first index of an array?
A. 3
B. 0
C. 2
D. 1
B. 0
What is the length of the following array: byte[] data = {12, 34, 9, 0, -62, 88};
A. 5
B. 6
C. 12
D. 1
B. 6
Must be specified by int or short value and not long.
A. method signature
B. return type
C. array size
D. modifier
C. array size
It is declared without using any modifier.
A. protected
B. default
C. public
D. private
B. default
The direct superclass of an array type.
A. awt
B. swing
C. java.lang.Object
D. Object
C. java.lang.Object
D. Object
A java method is defined once and invoked by writing its name without writing its code again.
A. inheritance
B. association
C. software issues
D. write once run anywhere
C. software issues
D. write once run anywhere
A collection of statements that perform some specific task and return the result to the caller.
A. method
B. object
C. class
D. function
A. method
D. function
Which of the following is FALSE about arrays on Java
A. A java array is always an object
B. Arrays in Java are always allocated on heap
C. Length of array can be changed after creation of array
C. Length of array can be changed after creation of array
It is accessible in all classes in your application?
A. protected
B. default
C. public
D. private
C. public
It is accessble only within the class in which it is defined?
A. protected
B. default
C. public
D. private
D. private
Indicates the access type of a method.
A. access modifier
B. function
C. abstraction
D. modifier
A. access modifier
D. modifier
You use a ____ following the closing brace of an array initialization list.
A. ;
B. ,
C. ;
D. .
C. ;