Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Language Fundamentals Questions
Which three piece of codes are equivalent to line 3? final int k = 4; public int k = 4; static int k = 4; abstract int k = 4; volatile int k = 4; protected int k = 4; public interface Foo { int k = 4; /* Line 3 */ }
Which is the valid declarations within an interface definition?
Which one is a valid declaration of a boolean?
What is the numerical range of a char?
Which is a valid declarations of a String?
Which is a valid keyword in java?
Which one of the following will declare an array and initialize it with five numbers?
Which three are valid declarations of a float? float f1 = -343; float f2 = 3.14; float f3 = 0x12345; float f4 = 42e7; float f5 = 2001.0D; float f6 = 2.81F;
Which is a reserved word in the Java programming language?
Which three are valid declarations of a char? char c1 = 064770; char c2 = 'face'; char c3 = 0xbeef; char c4 = \u0022; char c5 = '\iface'; char c6 = '\uface';
Which four options describe the correct default values for array elements of the types indicated? int -> 0 String -> "null" Dog -> null char -> '\u0000' float -> 0.0f boolean -> true
Which one of these lists contains only Java programming language keywords?
Which three are legal array declarations? int [] myScores []; char [] myChars; int [6] myScores; Dog myDogs []; Dog myDogs [7];
Which will legally declare, construct, and initialize an array?
What will be the output of the program? public class CommandArgsThree { public static void main(String [] args) { String [][] argCopy = new String[2][2]; int x; argCopy[0] = args; x = argCopy[0].length; for (int y = 0; y < x; y++) { System.out.print(" " + argCopy[0][y]); } } } and the command-line invocation is > java CommandArgsThree 1 2 3
What will be the output of the program? public class X { public static void main(String [] args) { String names [] = new String[5]; for (int x=0; x < args.length; x++) names[x] = args[x]; System.out.println(names[2]); } } and the command line invocation is > java X a b
What will be the output of the program, if this code is executed with the command line: > java F0091 world public class F0091 { public void main( String[] args ) { System.out.println( "Hello" + args[0] ); } }
What will be the output of the program? public class CommandArgsTwo { public static void main(String [] argh) { int x; x = argh.length; for (int y = 1; y <= x; y++) { System.out.print(" " + argh[y]); } } } and the command-line invocation is > java CommandArgsTwo 1 2 3
What will be the output of the program? public class TestDogs { public static void main(String [] args) { Dog [][] theDogs = new Dog[3][]; System.out.println(theDogs[2][0].toString()); } } class Dog { }
What will be the output of the program? public class Test { public static void main(String [] args) { signed int x = 10; for (int y=0; y<5; y++, x--) System.out.print(x + ", "); } }
1
2