Tag: programming languages

Questions Related to programming languages

  1. Windows

  2. Unix/Linux

  3. Macs

  4. All of the Above


Correct Option: D
  1. The server has a built-in JVM

  2. The browser has a built-in JVM

  3. The source code is interpreted by the browser

  4. Applets don''t need a JVM.


Correct Option: B
  1. An interactive website

  2. A Java program that is run through a web browser

  3. A type of computer

  4. A type of fruit


Correct Option: B
  1. A type of coffee

  2. An object-oriented programming language

  3. An interactive website

  4. None of the above


Correct Option: B
  1. Introducing new methods

  2. Adding components to specific areas of a container

  3. Starting an applet

  4. Specifying font size and color


Correct Option: B
  1. To avoid having to declare variables

  2. To refer to a class without using prefixes

  3. To avoid calling methods

  4. To import the images you want to use


Correct Option: B
  1. 0 0

  2. Compilation error, class A has no start method

  3. 0 1

  4. Compilation succeed but runtime exception


Correct Option: C
Explanation:

To understand the code, the user needs to know the basics of Java threads and anonymous inner classes.

The code defines a class A that extends Thread and overrides its run() method to print the values of i from 0 to 1. It also defines a class Test with a main() method that creates an instance of Test and calls its check() method with an anonymous inner class that extends A. The check() method calls the start() method on the A instance, which starts a new thread that executes the run() method.

Now let's go through each option and explain why it is true or false:

A. 0 0: This option is false. The code creates a new thread that executes the run() method of the A instance, which prints the values of i from 0 to 1. Since the start() method is called only once, the output will be either "0 1" or "1 0", depending on which thread runs first.

B. Compilation error, class A has no start method: This option is false. The A class extends Thread, which provides the start() method. Thus, there is no compilation error.

C. 0 1: This option is true. The code creates a new thread that executes the run() method of the A instance, which prints the values of i from 0 to 1. Since the start() method is called only once, the output will be either "0 1" or "1 0", depending on which thread runs first.

D. Compilation succeed but runtime exception: This option is false. There is no runtime exception in the code.

Therefore, the correct answer is:

The Answer is: C. 0 1