2
Q:

main() {

int i;

printf("%d",scanf("%d",&i)); // value 10 is given as input here

}

A) 1 B) 2
C) 3 D) 4

Answer:   A) 1



Explanation:

Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.

Subject: Java
Q:

What is JAR file?

Answer

A JAR file (short for Java Archive) is a ZIP file used to distribute a set of Java classes. It is used to store compiled Java classes and associated metadata that can constitute a program

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1954
Q:

What is the difference between throw and throws clause?

Answer

A throw is used to throw an exception manually, where as throws is used in the case of checked exceptions, to tell the compiler that we haven't  handled the exception, so that the exception will be handled by the calling function.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1656
Q:

What is Marker Interface?

Answer

An interface without having any methods and by implementing that interface if our objects will get same ability such type interfaces are called marker interface (or) ability interface (or) tag interface

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: IT Trainer

1 3088
Q:

Inside an interface when should the variables be initialized?

A) Globally B) Whenever required
C) Inside a function D) During the time of declaration
 
Answer & Explanation Answer: D) During the time of declaration

Explanation:

They should be initialized during the time of declaration itself otherwise it is a compilation eror

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: IT Trainer

0 4176
Q:

Which of the following statements are equal for a variable declared in the interface ?

1. int X=10
2. public int X=10
3. public static final int X=10

A) Only 1 and 2 are equal B) Only 2 and 3 are equal
C) All are unequal D) All are equal
 
Answer & Explanation Answer: D) All are equal

Explanation:

All the statements are equal because inside an interface a variable declared will be public static final by default 

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: IT Trainer

0 17937
Q:

Why interface method is always public?

Answer

To make this method available to every implementation class

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: IT Trainer

0 2236
Q:

Which of the following method declarations are allowed inside interface?

A) public void m1() B) private void m1()
C) protected void m1() D) abstract public void m1()
 
Answer & Explanation Answer: D) abstract public void m1()

Explanation:

Inside an interface every method will be by default abstract and public

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: IT Trainer

0 4111
Q:

X implements Y extends Z

A) X can be class Y,Z are interfaces B) X is an interface Y,Z are classes
C) X,Y are classes Z is an interface D) Complilation error
 
Answer & Explanation Answer: D) Complilation error

Explanation:

It is a compilation error it should be X extends Y implements Z

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: IT Trainer

3 5304