0

programming languages Online Quiz - 192

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

What happens when you compare two primitives of different numerical types?

  1. compiler error

  2. smaller type is promoted

  3. must explicitly cast

  4. none of the above


Correct Option: B

Are you allowed to have more than one top-level(non-inner) class definition per source file?

  1. True

  2. False


Correct Option: A

Assume the bit pattern of byte x is: 10110001. What will the sign of x be after x>>2?

  1. postive

  2. negative

  3. can't be find

  4. none of the above


Correct Option: B
  1. java.lang.Exception

  2. java.lang.Error

  3. java.lang.Throwable

  4. none of the above


Correct Option: C

What happens when you compare two primitives of different numerical types?

  1. compiler error

  2. smaller type is promoted

  3. must explicitly cast

  4. none of the above


Correct Option: B
  1. 1,3

  2. 2,3

  3. Compilation Error

  4. Exception


Correct Option: B
Explanation:

To solve this question, the user needs to know the basics of boolean expressions and how they work in Java programming. They also need to understand the concept of conditional statements.

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

The code starts by initializing the variable x to 5, and the boolean variables b1 and b2 to true and false, respectively.

The first conditional statement checks if the value of x is equal to 4 and if b2 is false. Since neither condition is true, the code skips the first print statement and moves on to the second one.

The second print statement prints "2" to the console.

The second conditional statement assigns the value true to b2 and then checks if b1 is also true. Since both conditions are true, the code executes the third print statement, printing "3" to the console.

Therefore, the output of the program is:

2 3

So, the correct answer is:

The Answer is: B

  1. compiletime error at lines 1,2,3,4

  2. compiletime error at line 3

  3. compiletime error at line 1

  4. compiletime error at lines 3,4


Correct Option: D
  1. compile time error at line1

  2. compile time error at line2

  3. Run time exception

  4. None Of the above


Correct Option: B

What type of inheritance does Java have?

  1. Single Inheritence

  2. Double Inheritence

  3. Multiple Inheritence

  4. Class Inheritence


Correct Option: A

Java runs on.

  1. Windows

  2. Unix

  3. Solaris

  4. All of the above


Correct Option: D
  1. The element will be successfully added

  2. ArrayIndexOutOfBounds Exception

  3. The Vector allocates space to accommodate up to 15 elements

  4. None of the above


Correct Option: A,C
  1. Stateless session beans doesn’t preserve any state across method calls

  2. Stateful session beans can be accesses by multiple users at the same time

  3. None of the above

  4. Allof the above


Correct Option: A
  1. Home Interface

  2. Remote Interface

  3. Bean Class

  4. All of the above


Correct Option: D
  1. the new method should return int

  2. the new method can return any type of values

  3. the argument list of new method should exactly match that of overriden method

  4. the return type of new method should exactly match that of overriden method


Correct Option: C,D
- Hide questions