click below
click below
Normal Size Small Size show me how
OOP LEC [FA2]
CS0070
| Question | Answer |
|---|---|
| Consider the following codes: int x=2; System.out.println(x--); What will be the EXACT output? Group of answer choices 1 2 4 3 | 2 |
| Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. Group of answer choices < > < >> | < |
| Consider the following codes: int x=4; System.out.println(x--); What will be the EXACT output? Group of answer choices 3 4 1 2 | 4 |
| What will be the output of the following program System.out.println(10 * 5 + 100 * (25 * 11) / (25 * 10) * 10 - 5 + 7 % 2); int zx = (10 * 5 + 100 * (25 * 11)); int yz = ((25 * 10) * 10 - 5 + 7 % 2); System.out.println(zx / yz); | 1146 11 |
| The _____ loop is for traversing items in a collection Group of answer choices do while for while foreach | foreach |
| An operator that decreases the value of operand by 1. Group of answer choices 1- -- ā -1 | -- |
| The for loop is for traversing items in a collection Group of answer choices false true | false |
| What will be the output of the following program? int i = 34.0; int j = 7; int k = i % j; System.out.println("k = " + k ); | Error |
| What is the operator in which The left operands value is moved right by the number of bits specified by the right operand and shifted values are filled up with zeros. Group of answer choices < >>> >> << | >> |
| Consider the following codes: int x=1; System.out.println(x++); What will be the EXACT output? Group of answer choices 1 2 3 4 | 1 |
| The ______ loop executes a given statement or a block of statements for a definite number of times. Group of answer choices do while for while | for |
| Consider the following codes: int x=3; System.out.println(x++); What will be the EXACT output? Group of answer choices 1 3 4 2 | 3 |
| What does a Two-Dimensional Array do? Group of answer choices It creates two arrays at once. It creates an array with only two elements. None of the choices It forms a tabular, two dimensional arrangement. | It forms a tabular, two dimensional arrangement |
| The break statement causes the program flow to exit from the body of the switch construct. Group of answer choices false true | True |
| What is the result of -7%2 Group of answer choices -2 2 1 -1 | -1 |
| It subtracts right operand from the left operand and assign the result to left operand. Group of answer choices *- /= += -= | -= |
| It divides left operand with the right operand and assign the result to left operand. Group of answer choices /= -= += *- | /= |
| The case statement is used to conditionally perform statements based on an integer expression Group of answer choices true false | False |
| Which of the following declares an array of int named img? Group of answer choices int img; new int img[]; int img = int[]; int[] img; | int[] img; |
| Consider the following codes: int x=4; System.out.println(7>>2); What will be the EXACT output? Group of answer choices 1 4 3 2 | 1 |
| The label identifies any valid statement to which control must be transferred Group of answer choices true false | True |
| The while loop executes a given statement or a block of statements for a definite number of times. Group of answer choices true false | False |
| What does the code output? int p=0; while (p<0) { System.out.println("hi"); } Group of answer choices It will output "hi" infinitely hi It won't output anything It will output an error! | It won't output anything |
| int x=2; System.out.println(--x); What will be the EXACT output? Group of answer choices 4 1 3 2 | 1 |
| What is the output of the following code fragment: int[] zip = new int[5]; zip[0] = 7; zip[1] = 3; zip[2] = 4; zip[3] = 1; zip[4] = 9; System.out.println( zip[ 2 + 1 ] ); Group of answer choices 4 4 3 1 3 7 | 1 |
| What is the output of the following code fragment? for ( int j = 5; j > -5; j-- ) System.out.print( j + " " ); System.out.println( ); 5 4 3 2 1 0 -1 -2 -3 -4 -5 -4 -3 -2 -1 0 5 4 3 2 1 0 5 4 3 2 1 0 -1 -2 -3 -4 -5 | 5 4 3 2 1 0 -1 -2 -3 - 4 |
| True or False. The first expression in the for loop syntax is the initialization of the counter variable. | True |
| Consider the following codes: int x=3; System.out.println(--x); What will be the EXACT output? | 2 |
| The ____ statement enables your program to selectively execute other statements, based on some criteria | if |
| An operator that can be used to add String objects. Group of answer choices | + |
| An operator that subtracts right-hand operand from left-hand operand. | - |
| [True or False] The lbl identifies any valid statement to which control must be transferred | false |
| decrease the value of the variable by a particular number by which it was decreased | decrement operators |
| The _____ statement performs a different set of statements if the expression is false. | else |
| The _______ loop facilitates evaluation of condition or expression at the end of the loop to ensure that the statements are executed at least once | do while |
| Which is first incremented and then used? Group of answer choices x++ +x x+ ++x | ++x |
| [True or False] The statements associated with else keyword is executed if the value of the switch variable does not match any of the case constants. | false |