click below
click below
Normal Size Small Size show me how
CCS0023 m1-4
| Question | Answer |
|---|---|
| The __________ creates a software simulation of a CPU and memory and handles all communication between the Java program and the underlying operating system and hardware. | JVM |
| A command for the documentation generator | javadoc |
| Java source code is compiled to produce bytecode file | True |
| What is the name of the class in this program: class HelloJava{ public static void main(String args[ ]){ System.out.println(“Hello Java”); } } | HelloJava |
| boolean data type has two or more values | false |
| Sun Microsystems is now a subsidiary of ? | Oracle Corporation |
| short has a value that ranges from -32768 to 32767 | true |
| static is a state of a method | true |
| The loader for java applications. | java |
| Every statement in Java language should end with ":"? | false |
| String is a primitive data type | true |
| The main method is non-static because it must be called before the class that hosts the method is instantiated | false |
| Who developed Java? | James Gosling |
| What is the name of the class in this program: class Rectangle{ public static void main(String args[ ]){ System.out.println(“This is a Rectangle”); } } | Rectangle |
| main method is void because the Java interpreter does not expect to receive or process any output from the class. | true |
| An IDE doesn't have debugger | false |
| Choose a Single Line Comment in Java Language below? | //Some comments |
| println()provides string formatting. | false |
| In standalone Java applications, which method is mandatory? | main method |
| double data type has a width of 8 in bytes. | true |
| Most IDEs today doesn't have GUI modeling utilities that simplify the development of UIs. | false |
| One of the tools for Object oriented design includes object inspector | true |
| It is a computer software to help computer programmers develop software. | Integrated Development Environment |
| What are the valid White Spaces available in Java language? | All the above (Enter, Space, Tab) |
| It reads a String value from the user. | nextLine() |
| nextFloat () reads a float value from the user. | true |
| It is a class used to get user input. | Scanner |
| What is the name of the class in this program: class HelloJava{ public static void main(String args[ ]){ System.out.println(“Hello Java”); } } | HelloJava |
| It reads a long value from the user. | nextLong() |
| Every statement in Java language should end with ","? | false |
| It reads a byte value from the user. | nextByte() |
| Choose a multiline comment in Java language below? | /*comments are going cars are moving*/ |
| A feature of java that provides extensive compile-time checking, followed by a second level of run-time checking. | Robust and secure |
| A valid identifier in Java language may contain which characters? | All the choices (0-9 , $, _ (Underscore) , A-Z, a-z ) |
| An operator that copies a bit to the result if it exists in both operands. | & (bitwise AND) |
| If any of the two operands are non-zero, then the condition becomes true. | || |
| What will be the output of the following program? int c = 0, e = 50; boolean b = (c == 1) || (++e < 100); System.out.println("e = " + e); boolean f = (e++ < 100) || (c == 1); System.out.println("e = " + e); | e = 51 e = 52 |
| The label identifies any valid statement to which control must be transferred | true |
| Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. | > |
| int a[] = new int[50]; int i = 27 % 11; int j = 5 * 3; int k = i - j; a[i] = i; a[j] = j; a[k] = k; int sum = 0; for(int l = 0; l < a.length; l++) {sum += a[l];} System.out.println("Sum = " + sum);}} output? | Throws ArrayIndexOutOfBoundsException |
| What will be the output of the following program? boolean a = true; boolean b = true; boolean c = a & b; boolean d = a ^ b; boolean e = a || !b || c || !d; System.out.println("e = " + e); | e = true |
| The continue statement causes the program flow to exit from the body of the switch construct. | false |
| decrease the value of the variable by a particular number by which it was decreased | decrement operators |
| ...1 {...{ short s = 10; int a = s; s += 10; System.out.println(s + "," + a); }} ...2 {... { short s = 10; int a = s; s = s + 10; System.out.println(s + "," + a); }} compare programs | Both CrossCheck1 and CrossCheck2 produce same output. |
| An operator that subtracts right-hand operand from left-hand operand. | - |
| It multiplies right operand with the left operand and assign the result to left operand. | *- |
| What will be the output of the following program? int i, j, k, l = 0; k = l++; j = ++k; i = j++; System.out.println(i); | 1 |
| An operator that divides left-hand operand by right-hand operand and returns remainder. | % |
| What is the index value of the first element? | 0 |
| output? boolean lampX = false, result; boolean lampY = true; result = lampY || lampX; System.out.println("Lamp switch-on " + result); result = lampY | lampX; System.out.println("Lamp switch-on " + result); | Lamp switch-on true Lamp switch-on true |
| It adds right operand to the left operand and assign the result to left operand. | += |
| output? for ( int count = 0; count < 9; ) System.out.print( count + " " ); count++ ;What is the result of -7%2 System.out.println( ); | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
| What is the result of -7%2 | -1 |
| The BREAK statement causes the program flow to skip over and jump to the end of the loop body, and then return the control to the loop control statement. | false |
| ... {...{ float f = 42.0f; float[] f1 = new float[2]; float[] f2 = new float[2]; float[] f3 = f1; long x = 42; f1[0] = 42.0f;}} which statements is true? f1 == f2,f1 == f3,f2 == f1[1], x == f1[0], f == f1[0] | f1 == f3 x == f1[0] f == f1[0] |
| Output? class ArrayOutput { public static void main(String s[]) { int a[] = {12, 15, 16, 17, 19}; for(int i = 5 - 1; i > 0; i--) { System.out.println(a[i]); } } } | 19 17 16 15 |
| What will be the output of the following program ? int a = 10; int b = 15; a++; b--; int c = b % a; System.out.println(c >= b); | false |
| out? boolean a=T;boolean b=F; System.out.println("a|b="+(a | b)); System.out.println("a&b="+(a & b)); System.out.println("a^b="+(a^b)); System.out.println("a^!b="+(a^!b)); System.out.println("!a&&b="+(!a&&b)); System.out.println("!a||!b="+(!a||!b)); | a | b = true a & b = false a ^ b = true a ^ !b = false !a && b = false !a || !b = true |
| output? boolean lampX = false, result; boolean lampY = true; result = lampY || lampX; System.out.println("Lamp switch-on " + result); result = lampY && lampX; System.out.println("Lamp switch-on " + result); | Lamp switch-on true Lamp switch-on false |
| An operator that copies a bit if it exists in either operand. | | (bitwise OR) |
| decrement operators decrease the value of the variable by a particular number by which it was decreased | true |
| output? int a = 4; a++; a += a; --a; a = 7 + a; a *= a; a -= 3; System.out.println(" a = " + a ); | a = 253 |
| ...{...{ int[][] input = {{3, 5, 6, 7}, {2, 4}, {1}, {2, 3, 4, 5}}; int result = 1; for(int i = 0; i < input.length; i++) {for(int j = 0; j < input[i].length - 1; j++) {result *= input[i][j];}} System.out.println("Result = " + result);}} | Result = 4320 |
| is an operator used to perform bitwise operations on bit patterns or binary numerals that involve the manipulation of individual bits | bitwise operator |
| output? {{int list[]=new int[] {1,8,7,4,5,6,3};int count=1; int copy[][]=new int[list.length][count]; for(int i=0; i<list.length; i++) {copy[i][0]=list[i]; for(int j=0; j<count; j++) {System.out.print(copy[i][j]+" ");}} System.out.println();}} | 1 8 7 4 5 6 3 |
| Is array suitable for holding the name, social security number, age, and income of one individual? | No |
| What is the output of the following code fragments? int [ ] fun = new int [5]; fun[0] = 1; fun[1] = 2; fun[2] = 3; fun[3] = 4; fun[4] = 5; int j = 3; System.out.println(fun[ j-1]) ; | 3 |
| What must the change be so that the following fragment prints out the even integers 0 2 4 6 8 10? for ( int j = 0; j <= 10; _______ ) System.out.print( j + " " ); System.out.println( ); | j = j+2 |
| What is the result of 7%2 | 1 |
| unary operator is an operator used to perform bitwise operations on bit patterns or binary numerals that involve the manipulation of individual bits | false |
| What is the result of ~1 | -2 |
| How many objects are present after the following code fragment has executed? double[] ann = new double[ 7 ]; double[] bob; bob = ann; | 1 |