0
Alien head

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

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

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

  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

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

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

  1. True

  2. False


Correct Option: B

Is Array operations are faster than Vector.

  1. True

  2. False


Correct Option: B

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

  1. True

  2. False


Correct Option: B

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

You are planning to do an indexed search in a list of objects. Which of the two Java collections should you use?

  1. ArrayList

  2. LinkedList

  3. Set

  4. None


Correct Option: A

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

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

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

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

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

Which one is faster in java ?

  1. No difference

  2. 1

  3. 2

  4. Cannot be determined


Correct Option: B

Can inner class have static members?

  1. True

  2. False


Correct Option: B

Guess the output :

  1. 15

  2. 123

  3. 6

  4. Exception


Correct Option: B

Guess the output ?

  1. 6

  2. 33

  3. 123

  4. Exception


Correct Option: B

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

Java enabled portable server-side applications are

  1. Web services

  2. Enterprise JavaBeans

  3. Java Servlets

  4. All the above


Correct Option: D
+ View questions