5
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 anonymous class?

Answer

Anonymous class is class without name.


EX:


class A {


}


class Demo {


    A r = new A() {


        }; //anonymous class


}


 

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1658
Q:

What is local class?

Answer

Local class is class defined inside method


EX;


class A { // top level class


  public static void main(string[] args) {


   class B { // local class


   }


}


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1761
Q:

what is non-static member class?

Answer

Non-static member class is a class defined inside outer class with out static modifier.


EX:


class A { // top level class or outer class


    ......


    class B { //non-static member class


    }


    .....


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1620
Q:

What is static member class?

Answer

Static member class is a class defined inside outer class with static modifier.


EX:


Class A {  //top level class or outer class


    .....


    static class B {  //static member class


    }


   .....


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1820
Q:

What is top level class?

Answer

Top level class is also called outer class. It is not defined inside any class.


Ex:


class A {  //top level class


 


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1688
Q:

How many types of classes are there in Java?

Answer

Two types of classes:


1) Top Level Class


2) Classes within Class


       i) member classes


             a) static member class


             b) non static member class


      ii) local classes


      iii) anonymous classes

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1712
Q:

What is the purpose of the wait(), notify(), and notifyAll() methods ?

Answer

The wait(), notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an object's wait() method, it enters the waiting state. It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods..

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1723
Q:

What are wrapped classes ?

Answer

Wrapped classes are classes that allow primitive types to be accessed as objects.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1736