Java question, Question 1,3,5,6,7,810 can choose more than one answer. Thank you
ID: 670115 • Letter: J
Question
Java question, Question 1,3,5,6,7,810 can choose more than one answer.
Thank you
QUESTION 1
What is the stored in the object obj in following line of code?
Box obj;
A. The memory address of allocated memory of object
B. null
C. Any arbitrary pointer
D. garbage
QUESTION 2
Which of these statements is incorrect?
A. Every class must contain a main() method.
B. Java applications do not require a main() method at all.
C. There can be only one main() method in a program.
D. The main() method must be made public.
QUESTION 3
Which of the following is a valid declaration of an object of class Box?
A. ox obj = new Box();
B. Box obj = new Box;
C. obj = new Box;
D. new Box obj;
QUESTION 4
What is the process of dening a method in terms of itself, meaning a method that calls itself?
A. polymorphism
B. abstraction
C. recursion
D. encapsulation
QUESTION 5
Which of the following is a method having same name as that of its class?
A. finalize
B. delete
C. constructor
D. getter
E. setter
QUESTION 6
Which of these operators is used to allocate memory for an object?
A. malloc
B. alloc
C. new
D. construct
QUESTION 7
Which method can be dened only once in a Java program?
A. main
B. finalize
C. static
D. private
QUESTION 8
Which of these statements is incorrect?
A. Each object instance of a class is allocated memory for the fields dened in the class.
B. If a method is declared as public it can be accessed by an instance of an object of the class containing that method.
C. The main() method must be made public.
D. Each object instance of a class is allocated memory for the methods dened in the class.
QUESTION 9
What modifier should you use on the members of a class so that they are not accessible to another class in a different package, but are accessible to any subclasses in any package?
A. public
B. private
C. protected
D. Use the default modifier
QUESTION 10
What is the process of dening more than one method in a class dierentiated by method signature?
A. Function overriding
B. Function overloading
C. Function doubling
D. None of the mentioned
Explanation / Answer
1.
B. null
2.
A. Every class must contain a main() method.
3.
B. Box obj = new Box;
4.
C. recursion
5.
C. constructor
6.
C. new
7.
A. main
8.
D. Each object instance of a class is allocated memory for the methods dened in the class.
9.
C. protected
10.
B. Function overloading
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.