Tag: programming languages

Questions Related to programming languages

  1. int $x;

  2. int 123;

  3. int _123;

  4. int #dim;

  5. int %percent;

  6. int central_sales_region_Summer_2005_gross_sales;


Correct Option: A,C,F
  1. If only line 1 is removed the code compiles.

  2. If only line 3 is removed the code compiles.

  3. If only line 5 is removed the code compiles.

  4. If lines 1 and 3 are removed the code compiles

  5. If lines 1, 3 and 5 are removed the code compiles.


Correct Option: C,E

package io; import java.io.*; public class TestFile { public static void main(String[] args) { File file = new File("test_file.txt"); System.out.print(" Fle Name = " + file.getName()); file.delete(); file.renameTo(new File("test_file2.txt")); System.out.print(" Fle Name = " + file.getName()); } }

  1. Null pointer Exception

  2. Fle Name = test_file.txt Fle Name = test_file.txt

  3. Compiler Error

  4. Fle Name = test_file.txt Fle Name = test_file2.txt


Correct Option: B

package io; import java.io.*; public class TestFile1 { public static void main(String[] args) { //No file exists by the name test_file.txt File file = new File("test_file.txt"); System.out.print(" Fle Name = "+file.getName()); System.out.print(" File Status = "+file.exists()); } }

  1. Fle Name = test_file.txt File Status = false

  2. Compiler Error

  3. Null Pointer Exception

  4. Fle Name = test_file.txt File Status = true


Correct Option: A

package inheritance; interface test_Int { void test(); } abstract class IntImplementer implements test_Int { public static void main(String[] args) { System.out.println("Hello World!"); } }

  1. No output

  2. Hello World!

  3. Compiler Error

  4. Exception


Correct Option: B

Signature has to be the same for overloading.

  1. True

  2. False


Correct Option: B