FREE E LEARNING PLATFORM
HOMEEXCEPTIONSOOPSJVMINTRO
 

I.C.S.E Board Java objective questions practise Paper 4 Answers




31. The explicit keyword takes how many arguments?

  1. 1
  2. 2
  3. 3
  4. 0

Answers : 1

The compiler is allowed to make one implicit conversion to resolve the parameters to a function. What this means is that the compiler can use constructors callable with a single parameter to convert from one type to another in order to get the right type for a parameter.

32. What is false about constructor ?

  1. Constructor cannot be synchronized in java
  2. Java does not provide default copy constructor
  3. Constructor can have a return type
  4. this and super keywrd can be used in a constructor

Answer : Constructor can have a return type

33. What is true about copy constructor

  1. Used when a function returns an object
  2. It can be defined with zero arguments
  3. The argument reference is passed by reference
  4. Used when object is passed by value to a function

Answer: It can be defined with zero arguments

34. Abstract class cannot have a constructor

  1. True
  2. False
  3. Both
  4. None

Answer : False

35. Which is odd in given option

  1. system
  2. object
  3. main
  4. strictfp

Answer : strictfp
strictfp is a modifier that stands for strict floating-point which was not introduced in the base version of java as it was introduced in Java version 1.2. It is used in java for restricting floating-point calculations and ensuring the same result on every platform while performing operations in the floating-point variable.

36. The purpose of a java constructor is

  1. Initialization of variables with passed data
  2. writing custom code
  3. Accepting oother objects as input
  4. All the above

Answer : All the above

37. Which is odd in given option

  1. student class{}
  2. class teacher{ public: teacher(int a){}}:
  3. class student{ public: student(int a){}}:
  4. None of the above

Answer student class{} as it is wrong declaration of class and others have correct declaration of class with constructor in the class.

38. What is the initial quatity of the arraylist list?
arraylist list = new arraylist();

  1. 10
  2. 0
  3. 100
  4. 5

Answer : Default initial capacity of ArrayList is 10.
java.util.ArrayList defines private static final variable DEFAULT_CAPACITY to define initial capacity of ArrayList.

39. Which is odd in given options

  1. int var;
  2. int VAR;
  3. int 1_var;
  4. int var1;

Answer : int 1_var; Invalid declaration of variables.

40. How many objects of the class will be created if the default constructor is not defined.

  1. Compiler provides the default constructor to build the object.
  2. The compiler will generate the error
  3. Error will occue at run time
  4. All the above

Answer : Compiler provides the default constructor to build the object.

You may also Find this interesting

Java Set 1

Java Set 2

JAVA Practise Paper Set 1 Answers

JAVA Practise Paper Set 2 Answers

JAVA Practise Paper Set 3 Answers







Leave Comment