I.C.S.E Board Java objective questions practise Paper 4 Answers
31. The explicit keyword takes how many arguments?
- 1
- 2
- 3
- 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 ?
- Constructor cannot be synchronized in java
- Java does not provide default copy constructor
- Constructor can have a return type
- this and super keywrd can be used in a constructor
Answer : Constructor can have a return type
33. What is true about copy constructor
- Used when a function returns an object
- It can be defined with zero arguments
- The argument reference is passed by reference
- 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
- True
- False
- Both
- None
Answer : False
35. Which is odd in given option
- system
- object
- main
- 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
- Initialization of variables with passed data
- writing custom code
- Accepting oother objects as input
- All the above
Answer : All the above
37. Which is odd in given option
- student class{}
- class teacher{ public: teacher(int a){}}:
- class student{ public: student(int a){}}:
- 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();
- 10
- 0
- 100
- 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
- int var;
- int VAR;
- int 1_var;
- 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.
- Compiler provides the default constructor to build the object.
- The compiler will generate the error
- Error will occue at run time
- All the above
Answer : Compiler provides the default constructor to build the object.
You may also Find this interesting
JAVA Practise Paper Set 1 Answers
JAVA Practise Paper Set 2 Answers
JAVA Practise Paper Set 3 Answers
Leave Comment