JAVA
2.7K subscribers
73 photos
111 files
76 links
Download Telegram
1) The default value of a static integer variable of a class in Java is,

(a) 0 (b) 1 (c) Garbage value (d) Null (e) -1.
2) What will be printed as the output of the following program?

public class testincr
{
public static void main(String args[])
{
int i = 0;
i = i++ + i;
System.out.println(“I = ” +i);
}
}

(a) I = 0 (b) I = 1 (c) I = 2 (d) I = 3 (e) Compile-time Error.
3) Multiple inheritance means,

(a) one class inheriting from more super classes
(b) more classes inheriting from one super class
(c) more classes inheriting from more super classes
(d) None of the above
(e) (a) and (b) above.
4) Which statement is not true in java language?

(a) A public member of a class can be accessed in all the packages.
(b) A private member of a class cannot be accessed by the methods of the same class.
(c) A private member of a class cannot be accessed from its derived class.
(d) A protected member of a class can be accessed from its derived class.
(e) None of the above.
5) To prevent any method from overriding, we declare the method as,

(a) static (b) const (c) final (d) abstract (e) none of the above.
6) Which one of the following is not true?

(a) A class containing abstract methods is called an abstract class.
(b) Abstract methods should be implemented in the derived class.
(c) An abstract class cannot have non-abstract methods.
(d) A class must be qualified as ‘abstract’ class, if it contains one abstract method.
(e) None of the above.
7) The fields in an interface are implicitly specified as,

(a) static only (b) protected (c) private
(d) both static and final (e) none of the above.