Saturday, April 20, 2024
HomeC Programmingjava questions for follow

java questions for follow


1. Iterator returned by Hashtable on key, worth and entry are?

A. Fail-fast

B. Fail-safe

C. Not one of the above 

2.Which of those are choice statements in Java ?

A. break

B. proceed

C. for()

D. if()

3.Which of those is a authorized definition of a way named examveda assuming it throws IOException, and returns void. Additionally assume that the strategy doesn’t take any arguments. Choose the one appropriate reply.

A. void examveda(void) throws IOException{}

B. void examveda() throw IOException{}

C. void examveda() throws IOException{}

D. void examveda() {} throws IOException

4.Which of those assertion is inaccurate ?

A. The primary() technique have to be made public.

B. There may be just one primary() technique in a program.

C. Applets don’t require a primary() technique in any respect.

D. Each class should comprise a primary() technique.

5.Iterator returned by ConcurrentHashMap on key, worth and entry is?

 A. Fail-fast

 B. Fail-safe

 C. None of above

6.Which of the next statements is appropriate ?

A. Public technique may be accessed by calling object of the general public class.

B. Public technique can solely be referred to as by object of its class.

C. Public technique is accessible solely to subclasses of its father or mother class

D. Public technique is accessible to all different courses within the hierarchy

7.Iterator returned by LinkedHashMap on key, worth and entry is?

A. Fail-fast

B. Fail-safe

C.  Not one of the above

8.hat is the return kind of a way that doesn’t returns any worth ?

A. double

B. void

C. float

D. int

9.What’s the means of defining multiple technique in a category differentiated by technique signature ?

A. Perform doubling

B. Perform overloading

C. Perform overriding

D. Not one of the above

10.Which of the next is a technique having similar title as that of its class ?

A. constructor

B. class

C. delete

D. finalize

11.Which technique may be outlined solely as soon as in a program ?

A. personal technique

B. static technique

C. finalize technique

D. primary technique

12.Iterator returned by TreeMap on key, worth and entry is?

A. Fail-fast

B.  Fail-safe

C. Not one of the above

13. Which of those assertion is inaccurate ?

A. primary() technique have to be made public.

B. All object of a category are allotted reminiscence for the all of the variables outlined within the class.

C. If a operate is outlined public it may be accessed by object of different class by inheritation.

D. All object of a category are allotted reminiscence for the strategies outlined within the class.

14.What’s the return kind of Constructors ?

A. void

B. int

C. float

D. Not one of the above

15.Iterator returned by ConcurrentSkipListMap on key, worth and entry is?

A.  Fail-fast

B. Fail-safe

C. Not one of the above

16. Which key phrase is utilized by technique to confer with the item that invoked it ?

A. this

B. summary

C. catch

D. import

17.Which of the next statements are incorrect ?

A. finalize() technique have to be declared protected.

B. Default constructor is known as on the time of declaration of the item if a constructor has not been outlined.

C. Constructor may be parameterized.

D. finalize() technique is known as when a object goes out of scope and is not wanted.

18.What’s means of defining two or extra strategies inside similar class which have similar title however completely different parameters declaration ?

A. technique hiding

B. technique overloading

C. technique overriding

D. Not one of the above

19.Which of those key phrase can be utilized in subclass to name the constructor of superclass ?

A. extends

B. extent

C. this

D. tremendous

20.What’s the means of defining a way in subclass having similar title & kind signature as a way in its superclass ?

A. Technique hiding

B. Technique overloading

C. technique overriding

D. Not one of the above

21.Which of those key phrases can be utilized to stop Technique overriding ?

A. ultimate

B. protected

C. fixed

D. static

22.Which Set implementation is sorted and synchronized?

 A. LinkedHashSet

 B. ConcurrentSkipListSet

 C. TreeSet

 D. CopyOnWriteArraySet

23.Which of those is appropriate manner of calling a constructor having no parameters, of superclass A by subclass B ?

A. tremendous();

B. tremendous.A();

C. superclass.();

D. tremendous(void);

24.TreeMap –

A. Would not allow null key

B. Permit a number of null values

C. Each the above

25. Which of those is supported by technique overriding in Java ?

A.  Polymorphism

B. Encapsulation

C. Abstraction

D. Not one of the above

26.Which of those is appropriate about passing an argument by call-by-value course of ?

A. Reference to unique argument is handed to formal parameter of the subroutine and adjustments made on parameters of subroutine have impact on unique argument.

B. Copy of argument is made into the formal parameter of the subroutine and adjustments made on parameters of subroutine have impact on unique argument.

C. Reference to unique argument is handed to formal parameter of the subroutine.

D. Copy of argument is made into the formal parameter of the subroutine.

27.What’s the means of defining a way by way of itself, that could be a technique that calls itself ?

A. Recursion

B. Encapsulation

C. Abstraction

D. Polymorphism

28.What would be the output of the next code –

import java.util.Collections;

import java.util.HashMap;

import java.util.Map;

public class MyClass

{

public static void primary(String args[])

{

Map<Integer,String> hashMap = new HashMap<Integer,String>();

hashMap.put(11,”a”);

Collections.unmodifiableMap(hashMap);

hashMap.put(12,”b”);

System.out.println(hashMap);

}

}

 A. {11=a}

 B. {11=a, 12=b}

 C. UnsupportedOperationException

 D. Compile time exception

29.Which ones is a not command line Instrument?

A .java

B.javaw

C.javapath

D.javadoc

30.What would be the output of the next code –

import java. util.Hashtable;

import java. util.Map;

public class hashTableBlog {

public static void primary (String args[])

{

Map<Integer,String> hashtable = new Hashtable<Integer,String>();

hashtable.put(11,”a”);

hashtable.put(null,”c”);

hashtable.put(null,null);

System.out.println(hashtable.measurement());

System.out.println(hashtable);

}

}

A. Runtime Exception

B. Compile time exception

C. 2 {11=bmw, null=fer}

31.What would be the output of the next code –

import java. util.HashMap;

class newEmployee

{

personal String title;

public newEmployee (String title)

{

this.title = title;

}

@Override

public int hashCode()

{

return 1;

}

}

class EmployeeClass

{

public static void primary(String args[])

{

HashMap hm=new HashMap();

hm.put(new newEmployee(“a”),”emp1″);

hm.put(new newEmployee(“b”),”emp2″);

hm.put(new newEmployee(“a”),”emp1 overridden”);

System.out.println(hm.measurement());

System.out.println(hm.get(new newEmployee(“a”)));

}

}

 A. 1 null

 B. 2 emp1 OVERRIDDEN

 C. 3 null

 D. 1 emp1 OVERRIDDEN

32.A/An___instance variable is shared by all cases of the category.It exist even earlier than the item is created

A.occasion

B.summary

C.interface

D.static

33.In Iterator, hasMoreElements() technique of Enumeration has been modified to:

A. hasNextElement()

B. isNext()

C. hasNext()

D. title stays similar

34.Which of the next isn’t a way of java.util.ArrayList?

A.add(Object x)

B.take away(Object x)

C.accommodates(Object x)

D.insert(int i,Object x)

E.set(int I,Object x)

35.TreeSet internally makes use of that one to retailer components?

A.  HashMap

B. LinkedHashMap

C. TreeMap

36.Offering entry to the item solely by way of its member features,whereas maintaining the small print personal is called_____

A.data hiding

B.encapsulation

C.Inheritance

D.modularity

37.HashSet internally makes use of?

A. HashMap

B. LinkedHashMap

C. TreeMap

38.Which of the next greatest descibes the set of all paires of values for boolean variables a and b such that, (!a && b)==!(a||b) evaluates to true?

A.Empty set

B.one pair a==true,b==false

C.two pairs through which a==true

D.two paires through which a!=b

E.All 4possible mixture

39.An try so as to add the null key to a TreeSet will end in:

A. Will compile

B. Compile time Exception

C. Error

D. Runtime – NullPointerException

40.A “has a” relationship between courses represents ___ and “is a” represents__

A.static,nonstatic class

B.Inheritance,Composition

C.Composition,Inheritance

D.Overriding,Overloading

41.TreeSet maintains which order?

A. Ascending Order

B. Descending Order

C. Not one of the above

42.What’s the default structure supervisor for a panel?

A.BorderLayout

B.Ther is not any structure

C.FlowLayout

D.GridLayout

43.Enumeration returned by ArrayList is

A. Fail-fast

B. Fail-safe

C. Not one of the above

44.What occurs in a way if an unchecked exception is thrown in a strive block and there’s no matching catch block?

A.program ignores exceptn

B.program halts instantly

C.Program is not going to compile

D.Not one of the above

45.That are the values in arr after execution of following.. Int[]arr={1,1,0,0,0}; for(int i=2;i < arr.size;i++) arr[i]=arr[i-1]+arr[i-2];

A.11011

B.1121

C.11222

D.11235

E.11248

46.LinkedHashMap permits

A. One null key

B. Many null values

C. Each the above

47.Which isn’t a traits of Java programming language?

A.Sturdy

B.Procedural

C.Distributed

D.Multithreaded

48.Hashtable permits

A. One null key

B. Many null values

C. Not one of the above

49.Which of the next isn’t a way of the Thread class.

A. public void run()

B. public void begin()

C. public void exit()

D. public ultimate int getPriority()

50.A decrease precision may be assigned to a better precision worth in Java. For instance a byte kind knowledge may be assigned to int kind.

A. True

B.False

Query No Reply 

1

2

3 C

4

5 B

6

7 A

8 B

9 B

10 A

11

12 A

13

14

15 B

16 A

17

18 B

19

20 C

21 A

22 B

23 A

24 B

25 A

26

27 A

28 B

29 C

30 A

31 C

32 A

33 C

34

35 C

36 B

37 A

38 C

39

40 C

41 A

42 A

43 A

44 B

45

46 C

47 B

48 C

49 C

50 A

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments