My Daypo


Title of test:

Programming In The Large

(Other tests from this author)

Creation Date:


Number of questions: 104
Share the Test:
Share the Test:
Last comments
No comments about this test.
Each java statement must end with a semicolon True False.
A variable is a name associated with a particular memory location True False.
In Java programming language, the variables X and x are identical True False.
The computer prints the text after // on the console when the program is executed True False.
Scanner class is imported by default for reading input from the console True False.
The data supplied via the Scanner object is stored in the hard disk of the computer True False.
"\n" positions the screen cursor to the beginning of the current line True False.
$4 is a valid identifier (name) for a variable, method or class in Java True False.
Two variables of the same type can be declared in one statement in a java program True False.
System.out.println(1 / 2); prints 0.5 True False.
System.out.println(1 % 2); prints 1 True False.
System.out.println("1.0 / 3.0 is " + 1.0 / 3.0); prints 1.0 / 3.0 is 0.33333333 True False.
System.out.println("1.0 / 3.0 is " + 1.0 + 3.0); prints 1.0 / 3.0 is 1.03.0 True False.
A floating-point literal (value) is assumed to be of type float True False.
The currentTimeMillis method in the DateTime class returns the current time in milliseconds elapsed since the time midnight, January 1, 1970 GMT True False.
The relational (comparison) operators have higher precedence than arithmetic operators True False.
The expression: x = x + 1; is equivalent to this expression: x++; True False.
The arithmetic operators +, -, *, / and % have the same level of precedence True False.
Both statements x++ and ++x have the same effect in a mixed arithmetic expression True False.
The associatively of the assignment and augmented assignment operators is from left to right True False.
Casting is necessary if you are assigning a value to a variable of a larger type range True False.
double x = 1.0 - 0.1 - 0.1 - 0.1 - 0.1 - 0.1; System.out.println(x == 0.5); prints false True False.
If(number % 2 == 0 ^ number % 3 == 0) checks whether number is divisible by both 2 or 3. True False.
The statements following else in an if-else are executed when the condition of if is false. True False.
The default keyword in the switch statement structure is mandatory True False.
All the binary operators except assignment and augmented assignment are left associative True False.
Math.PI and Math.E are two useful float constants provided by Math class True False.
Math.floor(−2.1) returns -2.0 True False.
Math.ceil(−2.1) returns −2.0 True False.
The expression: 50 + (int)(Math.random()*50) returns a random integer between 50 and 99 True False.
You cannot use == operator to check whether two string variables have the same contents True False.
if(x%2 == 0); System.out.println("even"); prints the word "even" for any value of variable x True False.
int i = 0; while (i < 10) System.out.print(i); i++; prints 0123456789 True False.
The break statement inside a loop causes loop to exit True False.
int i = 0; while (i < 10) { System.out.print(i); i--; } prints the value of variable i infinitely True False.
The code: for( ; ; ) is equivalent to this code: while(true) which imply to infinite loop True False.
The initialize expression and increment/decrement expression are optional in the for loop True False.
The code: for(int i = 0 ; i < 10 ; i++) is not equivalent to this code: for(int i = 0 ; i < 10 ; ++i) True False.
The code: int i = 0; do {System.out.print(i); i++;} while(i<10) has a syntax error True False.
Using floating-point numbers in the loop continuation condition may cause numeric errors True False.
The body of do/while loop is executed zero or more times True False.
A value-returning method can also be invoked where caller ignores its return value True False.
When a variable is passed to a method, it is passed by value to this method True False.
A return statement can also be used for terminating a void method True False.
The passed argument to a method may have the same name as its corresponding parameter declared in the method's signature True False.
If two methods have the same name but different return types within one class, then they are overloaded methods. True False.
The scope of a variable is the part of the program where the variable can be referenced True False.
A variable can be declared multiple times in nested blocks True False.
for (int i = 0 ; i < 10 ; i++) {} System.out.println(i); prints 10 True False.
int[] refVar; allocates space in memory for an array and assigns its reference to refVar True False.
double[] myList = {1.9, 2.9, 3.4}; creates an array and also fills in its with initial values True False.
An array can store many values of different types True False.
An array size is fixed after an array reference variable is declared True False.
The elements in an array must be of a primitive data type True False.
int[] list={10,20}; for(int i=0; i<list.length(); i++) System.out.println(list[i]); is correct code True False.
To copy an array named arr1 into an array of the same size named arr2, just write: arr2=arr1; True False.
When passing an array to a method, just the reference of the array is passed to the method True False.
When a method returns an array, the array itself is returned to the caller True False.
public static void print(int n , int... numbers) is valid header for a method. True False.
double[][] myList = {{1.9, 2.9}, {5.7}}; is valid syntax to create and initialize a ragged array True False.
The rows in a two-dimensional array may have different lengths True False.
The numbers of rows and columns in a two-dimensional array must be equal True False.
N nested for loops are often used to process N-dimensional array True False.
It is not necessary that a Java program contain a main class True False.
Each class in the source code is written into a .class file True False.
The .class file is compiled into .java file True False.
The System class is imported by default in any java program because it is in ……… package java.lang java.util java.math javafx.geometry.
………. is a correct comment form */…/* */*…*/* ///…/ {…}.
The ……… package is imported by default in any java project java.lang java.util java.math javafx.geometry.
An identifier (name) for a variable, method or class must not start with ……….. _ (Underscore) $ (dollar Sign) letter digit (0…9).
.......... is not a correct variable type float short byte real.
To declare a named value as constant, you must use the keyword ……… before its name const final static abstract.
........ is numeric data type of two-bytes width for storing integers byte short int long.
An integer literal (value) is assumed to be of the ……… type byte short int long.
………. is the escape character used for printing TAB on the console 't' 'T' '\t' '\T'.
double a = 6.5; System.out.println(a += ++a); prints ……. 13 14 15 16.
The value of variable x after executing the following statement is ……….. int x = 3 * 4 – 2 * ( ( 2 + 10 ) / 2 ) – 2; 58 -2 40 -12.
int x = 2; System.out.println(++x + 13 + x++); prints ……….. 17 20 16 19.
int sum = 0; sum += 4.5; sum += 4.5; prints ……. 9.0 9 8.0 8.
The following expression: a = b += c = d is equivalent to: ………. a = (b += (c = d)) a = ((b += c) = d) ((a = b) += c) = d (a = b) += (c = d).
The ………. follows the case keyword in the switch statement ; (Semicolon) – (Dash) : (Colon) \n (Newline).
The syntax: ………. is required to end each case in the switch statement structure. end; break; stop; return; .
Math.rint(−2.5) returns ……….. -2 -2.0 -3 -3.0.
To get random lowercase letter in the ASCII range 97-122, you must use this expression: ………. (char)(((int)(97 + Math.random())) * 26) (char)(97 + ((int)(Math.random())) * 26) (char)(97 + (int)(Math.random() * 26)) (char)(97 + (int)(Math.random() * 25)).
Class ……… is responsible for storing and handling text data. String Scanner Math System.
"abc".compareTo("abg") returns ……….. 4 -4 4.0 -4.0.
To extract the substring "to" from String msg = "Welcome to Java"; you must write: ……….. msg.substring(7, 9) msg.substring(7, 10) msg.substring(8, 9) msg.substring(8, 10).
"Welcome to Java".indexOf('o',5); returns ……….. 4 5 9 10.
"Welcome to Java".lastIndexOf("Java",5); returns ……….. 11 12 0 -1.
int i = 1; while (i < 10); System.out.print(i); prints ………. nothing 1 123456789 10.
int i = 1; do {System.out.print(i); i++;} while(i>10); prints ………. nothing 1 123456789 10.
The final value of variable x after running the following code is ……….. int x; for (x = -5 ; x < 6 ; x += 3) {} 7 6 5 4.
The while loop is guaranteed to execute ………. time(s). 0 1 2 Infinitely.
int i = 1; while(i < 10) if(i%2 != 0) continue; System.out.print(i); i++; prints ……… nothing 1 2468 10.
String[] strArray = {"hany","ali"}; System.out.print(strArray); prints ………. hany hanyali address of the array in the heap stored in strArray variable will not compile because of syntax error.
char[] city = {'D', 'a', 'l', 'l', 'a', 's'}; System.out.print(city); prints ……… D Dallas address of the array in the heap stored in strArray variable will not compile because of syntax error.
int[] list={1,2,3}; for(int i=0; i<list.length-1; i++) System.out.print(list[i]+" "); has ……… error. syntax runtime logic no.
The index number of the last element of an array with 30 elements is ………. system-defined programmer-defined 30 29.
int[] list={1,2,3}; for(int i=0; i<list.length(); i++) System.out.print(list[i]+" "); has ……… error syntax runtime logic no.
The syntax: ………. correctly declares an array called x. int[] x; array[] x; int{} x; array{} x;.
An integral literal (value) is assumed to be of type int True False.
String is a built-in primitive type True False.
A variable of reference type is initialized by default to the zero value True False.
A real floating-point literal (value) is assumed to be of the ……… type float double decimal real.
Report abuse Terms of use
Author's Tests