Tag: programming languages

Questions Related to programming languages

  1. Includes external files

  2. Includes SAS datasets

  3. Includes variables from other datasets

  4. All of the above


Correct Option: A
  1. In simple index, the index name must be same as the column name.

  2. The values must be in sorted form

  3. Indexing helps to retrieve the data faster

  4. All of the above


Correct Option: A,C

char* riteshFunc (char *ptr) { ptr += 3; return (ptr); } int main() { char *x, *y; x = "HELLO"; y = riteshFunc(x); printf ("y = %s \n", y); return 0; } What will print when the sample code above is executed?

  1. HELLO

  2. ELLO

  3. LLO

  4. LO


Correct Option: D

What will be the result of compiling and running the following code? (Assume that assertions are enabled at compile time as well as at runtime.) class Test { String f(int i) { switch (i) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: assert false; } } public static void main(String[] args) { Test t = new Test(); for (int i = 0; i < 4; i++) { System.out.print(t.f(i)); } } }

  1. Prints "ABC" and throws AssertionError

  2. Prints "ABC" and throws AssertionException

  3. Prints "ABC" and exits without any error

  4. Compilation error

  5. Run time exception

  6. None of the above


Correct Option: D

Given the code below, which access modifiers (public, protected, or private) can legally be placed before the myMethod() method on line 3, if no other changes are made to the code? If line 3 is left as it is, which keywords can legally be placed before the myMethod method on line 8? 1. class HumptyDumpty 2. { 3. void myMethod() {} 4. } 5. 6. class HankyPanky extends HumptyDumpty 7. { 8. void myMethod() {} 9. }

  1. . private or nothing (default) on line 3. Nothing (default) or protected or public on line 8.

  2. public or protected on line 3. private or nothing (default) on line 8.

  3. Nothing (default) or protected or public on line 3. private or nothing (default) on line 8.

  4. public on line 3 and private on line8.


Correct Option: A
  1. Throw AssertionError

  2. Throw IllegalStateException

  3. Throw IllegalArgumentException

  4. Throw InvalidArgumentException


Correct Option: C

What will be printed on standard output if the following class is executed using the command "java Test 1 two 3" ? public class Test { static public void main(String[] args) { try { int k = Integer.parseInt(args[1]); System.out.println(args[k]); } catch (Exception e) { System.out.println(e); } } }

  1. 1

  2. two

  3. NumberFormatException

  4. ArrayIndexOutOfBoundsException

  5. Code does not compile


Correct Option: C

What will be the result of compiling and running the following code? public class MyThread extends Thread { public static void main(String[] args) { new MyThread().start(); } }

  1. Compile-time error

  2. Runtime error

  3. No output

  4. None of these


Correct Option: C