Packages

Java packages quiz on JAVA Programming 

1
Created on By wefru

Packages

TEST YOUR SKILLS BRODLY

1 / 10

Q.101 If m and n are int type variables, what will be the result of the expression m%n when m=-14 and n=-3?

2 / 10

Q.102

Consider the following code

if(number>=0)

if(number>0)

system.out.println(“Number is positive”);

else

system.out.println(“Number is negative”);

What will be the output if number is equal to 0?

3 / 10

Q.103

Consider the following code:

char c=’a’;

switch (c)

{
case ‘a’;

system.out.println(“A”);

case ‘b’;

system.out.println(“B”);

default;
system.out.println(“C”);
}

For this code, which of the following statement is true?

4 / 10

Q.104

Consider the following class definition.

class Student extends String
{
}

What happens when we try to compile this class?

5 / 10

Q.105

What is wrong in the following class definitions?

abstract class print

{
abstract show();
}
class Display extends Print
{
}

6 / 10

Q.106

What is the error in the following class definitions?

abstract class XY
{
abstract sum(int x, int y){ }
}

7 / 10

Q.107

Which of the following statements are true?

i) We cannot use abstract classes to instantiate objects directly.

ii) The abstract methods of an abstract class must be defined in its subclass.

iii) We cannot declare abstract constructors.

iv) We may declare abstract static methods.

8 / 10

Q.108 We would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would archive this?

9 / 10

Q.109 The use of a protected keyword to a member in a class will restrict its visibility as follows:

10 / 10

Q.110

Consider the following code:

interface Area
{
float compute (float x, float y);
}
class Room implements Area
{
float compute (float x, float y)

{
return(x&y);
}
}

Your score is

The average score is 30%

0%

Leave a Reply