0

programming languages Online Quiz - 301

Description: programming languages Online Quiz - 301
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Java enabled portable server-side applications are

  1. Web services

  2. Enterprise JavaBeans

  3. Java Servlets

  4. All the above


Correct Option: D

What will be the output ?

  1. Inside TRY Inside FINALLY

  2. Inside TRY

  3. Inside TRY Inside CATCH Inside FINALLY

  4. None of the above


Correct Option: A

Guess the output ?

  1. 6

  2. 33

  3. 123

  4. Exception


Correct Option: B

AI Explanation

To answer this question, we need to analyze the code that produces the output.

Since there is no code provided, it is difficult to determine the exact output. However, based on the given options, we can make an educated guess.

Option A) 6 - This option is unlikely to be the correct answer since it is the smallest number among the options provided.

Option B) 33 - This option is a possibility for the correct answer since it is the only two-digit number among the options.

Option C) 123 - This option is unlikely to be the correct answer since it is the largest number among the options provided.

Option D) Exception - This option is possible if there is an error or exception in the code, causing it to terminate abruptly.

Based on the provided options, the most likely correct answer is B) 33 since it is the only two-digit number. However, without the code, it is impossible to determine the exact output.

Guess the output :

  1. 15

  2. 123

  3. 6

  4. Exception


Correct Option: B

Can inner class have static members?

  1. True

  2. False


Correct Option: B

Which one is faster in java ?

  1. No difference

  2. 1

  3. 2

  4. Cannot be determined


Correct Option: B

What will be the output ?

  1. The value of d is 65

  2. The value of d is a

  3. The value of d is A

  4. Compilation Error


Correct Option: D

After the following code fragment, what is the value in a? String s; int a; s = "Foolish boy."; a = s.indexOf("fool");

  1. -1

  2. 0

  3. 4

  4. none


Correct Option: A

Given the following code fragment: int A[]; int i = 0; A = new int A[4]; while (i < 4) { A[i] = 10; i = i + 1; } What is the value of A[3]?

  1. 0

  2. 3

  3. 10

  4. Compile Error


Correct Option: C

What is the purpose of this bit of code void init() { ... } ?

  1. a class that initializes the applet

  2. A required method in an applet

  3. A place to declare variablesA place to declare variables

  4. none of the above


Correct Option: B
Explanation:

To understand the purpose of this bit of code, the user needs to know that this is a method definition in Java. The method name "init" suggests that this code is related to initializing something, but more context is needed to determine what that something is.

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

A. A class that initializes the applet: This option is incorrect because this code does not define a class. It defines a method called "init". While this method may be used to initialize an applet, it is not itself a class.

B. A required method in an applet: This option is correct. In Java, "init" is a required method in applets. This method is called by the Java Virtual Machine (JVM) when the applet starts. It is used to perform any necessary initialization before the applet can be displayed.

C. A place to declare variables: This option is incorrect because this code does not declare any variables. It defines a method, which may use variables, but it does not itself declare any.

D. None of the above: This option is incorrect because option B is correct. "init" is a required method in applets.

Therefore, the answer is: B

What is the value of k after the following code fragment? int k = 0; int n = 12 while (k < n) { k = k + 1; }

  1. 0

  2. 11

  3. 12

  4. -1


Correct Option: C

If you have reference variable of parent class type and you assign a child class object to that variable and invoke static method. Which method will be invoked? Parent/Child.

  1. Parent

  2. Child

  3. Both

  4. None of these


Correct Option: A

Can we declare derived class first and then base class in java?

  1. True

  2. False


Correct Option: B

Is Array operations are faster than Vector.

  1. True

  2. False


Correct Option: B

Does File class have any method to read or write content in a file?

  1. True

  2. False


Correct Option: B

Final variables declared without initialization can be initialized in static initializer ( static final var) or in constructor( final var). True/False?

  1. True

  2. False


Correct Option: B

Is the following statement correct: char ch = 'd'; if(ch < 32.00){ }

  1. True

  2. False


Correct Option: B

If there is an exception in finalize method, will the object be garbage collected?

  1. True

  2. False


Correct Option: B

Which one of these statements are valid? Char \u0061r a =’a’; Char \u0062 = ’b’; Char c =’\u0063’Which one is not correct A. x = = Float.NaN B. Float.isNan(x); C. Myobject .equals(float.NaN);

  1. A

  2. B

  3. C

  4. All


Correct Option: D
- Hide questions