Tag: programming languages

Questions Related to programming languages

  1. Reboot the Machine

  2. Disable the print screen key

  3. Change the default screen color

  4. puts Capslock on


Correct Option: D
  1. null

  2. Primary Key class

  3. Home Object

  4. Remote Object


Correct Option: A
  1. Compilation fails due to error at line 1,2,3,4

  2. Compilation fails due to error at line 3,4

  3. Compiles fine and exception is thrown at runtime.

  4. Compiles fine and prints "check check 20.01"


Correct Option: D
Explanation:

To solve this question, the user needs to understand the concepts of Hashtable and data types in Java.

The code creates a Hashtable named ht, which maps keys to values. It puts three key-value pairs into the Hashtable:

  • "chec" is mapped to "check"
  • 1000 is mapped to "check"
  • "check" is mapped to 20.01

The code then retrieves the values corresponding to three keys and prints them out.

Now let's go through each option and explain why it is right or wrong:

Option A: Compilation fails due to error at line 1,2,3,4 This option is incorrect. There are no compilation errors in this code.

Option B: Compilation fails due to error at line 3,4 This option is incorrect. There are no compilation errors in this code.

Option C: Compiles fine and exception is thrown at runtime. This option is incorrect. The code compiles without errors, but no exception is thrown at runtime. The output of the code is "check check 20.01".

Option D: Compiles fine and prints "check check 20.01" This option is correct. The code compiles without errors, and when run, it prints "check check 20.01". The keys "chec" and 1000 are mapped to the value "check", while the key "check" is mapped to the value 20.01.

Therefore, the answer is: D. Compiles fine and prints "check check 20.01".

  1. The Session is not valid in the new Window

  2. The Session is valid in the new Window

  3. The Scope is not valid in the new Window

  4. The Scope is valid in the new Window


Correct Option: B
  1. A. It would fail to compile

  2. B. It would generate a run-time error on execution.

  3. C. It would execute, but ask the user to specify the directory in which to create ll.txt.

  4. D. It would execute without an error and print "hi" to a file called ll.txt


Correct Option: D