Sail E0 Webinar

MCQs

Total Questions : 50 | Page 2 of 5 pages
Question 11. Which of the following is FALSE about arrays on Java
  1.    A java array is always an object
  2.    Length of array can be changed after creation of array
  3.    Arrays in Java are always allocated on heap
  4.    none of the above
 Discuss Question
Answer: Option B. -> Length of array can be changed after creation of array
Question 12. The process by which objects of one class acquire the properties of objects of another class is known as
  1.    Polymorphism
  2.    Inheritance
  3.    Data Hiding
  4.    Association
 Discuss Question
Answer: Option B. -> Inheritance
Question 13. When does method overloading is determined?
  1.    At run time
  2.    At compile time
  3.    At coding time
  4.    At execution time
 Discuss Question
Answer: Option B. -> At compile time
Question 14. Which of these statement is incorrect?
  1.    Every class must contain a main() method
  2.    Applets do not require a main() method at all
  3.    There can be only one main() method in a program
  4.    main() method must be made public
 Discuss Question
Answer: Option A. -> Every class must contain a main() method
Question 15. String s1 = "hello";String s2 = new String("hello");if (s1 == s2) System
  1.    Hey
  2.    Yo
  3.    There is no output.
  4.    This code will not compile.
 Discuss Question
Answer: Option B. -> Yo
Question 16. Which of the following are not Java modifiers?
  1.    public
  2.    private
  3.    friend
  4.    transient
 Discuss Question
Answer: Option C. -> friend
Question 17. Int x = "bob"
  1.    Good
  2.    Bad
  3.    There is no output.
  4.    This code will not compile.
 Discuss Question
Answer: Option A. -> Good
Question 18. What will the following program segment display?for(int a = 2; a <= 10; a += 3)System
  1.    2 5 8
  2.    2 5
  3.    2 5 8 11
  4.    2
 Discuss Question
Answer: Option B. -> 2 5
Question 19. Int x = "Mary"
  1.    Yes
  2.    No
  3.    There is no output.
  4.    This code will not compile.
 Discuss Question
Answer: Option B. -> No
Question 20. Int [] nums = {2, 3, 5, 8, 9, 11};How would you access the fourth element in nums?
  1.    nums[4]
  2.    nums[3]
  3.    nums(4)
  4.    nums(3)
 Discuss Question
Answer: Option B. -> nums[3]

Latest Videos

Latest Test Papers