Time Left - 08:00 mins

RRB JE (IT): JAVA Programming Quiz 4

Attempt now to get your rank among 336 students!

Question 1

Which of the following are legal array - declarations?

(i) int [ ] myScores [ ];

(ii) char[ ] myChars;

(iii) int [6] myScores;

Question 2

Which of the following is not considered as an OOPS concept in Java?

Question 3

The component that is responsible for converting bytecode into machine specific code________.

Question 4

What will be output of the following code?

Byte x = 64, y;

Y = (byte) (x< < 2);

System. out. Println (y):

Question 5

Which options describe the correct default values for array elements of the types indicated?

i. int 0

ii. String -> “null”

iii. char ‘u0000’

iv. float 0.0 f

v. Boolean true

Question 6

Which one of the following will declared an array and initialize it with five numbers?

Question 7

Given two files, what will be the output?

package pck1;

public class A

{

int x=10:

public int y- 20:

}

package pck2:

import pck1.*;

class Test

{

public static void main

(String [ ] args)

{

A a= new AO: //line 7

system.out.println(a.x):

// line 8

system.out.println(a.y):

// line 9

}

}

Question 8

Fill in the blank to compile the code successfully.

abstract class A

{

int a = 100:

public abstract void showA ( ):

}

public class B extends A

//Fill the

Blank

public static void main(String[]args)

{

A objA = new A():

objA.showA():

}

}

Question 9

In Java, elements of an array are automatically initialized to some default value. What is the default value for the elements of an array of integers?

Question 10

You want to initialize all the elements of a double array a to the same value equal to 1.5.

What could you write?

Assume that the array has been correctly initialized.

  • 336 attempts
  • 1 upvote
  • 4 comments
Mar 31GATE & PSU CS