I.C.S.E Board Java objective questions practise Paper 3 Answers
21. Which is odd in given option
- Function
- Method
- A block of code in {}
- Package
Answer : d. Package
22. A function that modifies its parameters is
- Virtual function
- Pure function
- Impure function
- None
Answer : impure function
Pure functions :
Pure functions take objects and/or primitive data types as arguments but does not modify the objects.Pure functions doesn't have side effects.
Impure Functions: Impure functions change the state of received objects.
Impure functions have side effects.
23. The prototype of a function take ( that returns an int and receives an array ) is
- Public int take ( int ar [])
- Public int take ( int ar )
- Public int take ( int int ar [])
- None of the above
Answer a. Public int take ( int ar [])
24. Given the code int Change(int p, int q)
- Change(10,20)
- R = Change(10,20)
- Change(10.5, 12. 5 )
- None
Answer Change(10,20)
25. Which is odd in given option
- Import statement
- Function prototype
- Signature of a function
- Function Declaration
Answer : Import Statement.
26. Which of the following is used to call default contsructor in java
- super()
- that()
- sub
- This
Answer : This
Here is given the 6 usage of java this keyword.
this can be used to refer current class instance variable.
this can be used to invoke current class method (implicitly)
this() can be used to invoke current class constructor.
this can be passed as an argument in the method call.
this can be passed as argument in the constructor call.
this can be used to return the current class instance from the method.
27. Which principal in Object Oriented Programming is followed during Java Constructor Overloading
- Polymorphism
- Encapsulation
- Inheritance
- None
Answer a. Polymorhism
28. Which is od in the given option
- Use of pointers
- Dyanmic
- Object Oriented
- Architectural Neutral
Answer Use of Pointers
29. What is the output if this() and super() is used in the method
- Compile Time Error
- Run Time Error
- Throws Exception
- Runs Succesfully
Answer : Compile Time Error
super() as well as this() both are used to make constructor calls. super() is used to call Base class's constructor(i.e, Parent's class) while this() is used to call current class's constructor.
super() is use to call Base class's(Parent class's) constructor.
We can use super() only inside constructor and nowhere else, not even in static context not even inside methods and super() should be first statement inside constructor.
this() is used to call current class's constructor.
We can use this() only inside constructor and nowhere else, not even in static context not even inside methods and this() should be first statement inside constructor.
Important points about this() and super()
We can use super() as well this() only once inside constructor. If we use super() twice or this() twice or super() followed by this() or this() followed by super(), then immediately we get compile time error i.e, we can use either super() or this() as first statement inside constructor and not both.
It is upto you that whether you use super() or this() or not because if we are not using this() or super() then by default compiler will put super() as first statement inside constructor.
29. A constructor is initialized when
- There is a constant variable in the class
- There is a reference variable in the class
- There is an object of another class , and other class doesn't have a default constructor
- All the above
Answer All the above
30. In derived class, can the constructor be overloaded
- Yes, if the derived class have no constructor
- Yes, always
- No
- Both a and b
Answer no
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