Sail E0 Webinar

MCQs

Total Questions : 50 | Page 3 of 5 pages
Question 21. Which of these keywords is used to make a class?
  1.    class
  2.    struct
  3.    int
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> class
Question 22. Which of these class is highest in hierarchy in java
  1.    java.lang.Exception
  2.    java.lang.Error
  3.    java.lang.Throwable
  4.    java.lang.Object
 Discuss Question
Answer: Option D. -> java.lang.Object
Question 23. Int p = "Go Paw Patrol!"
  1.    0
  2.    4
  3.    3
  4.    -1
 Discuss Question
Answer: Option D. -> -1
Question 24. String s = "cool cat"
  1.    "cat"
  2.    "at"
  3.    "cool c"
  4.    This code does not compile.
 Discuss Question
Answer: Option B. -> "at"
Question 25. What are the legal indexes for the array ar, given the following declaration:int[] ar = {2, 4, 6, 8 }
  1.     0, 1, 2, 3
  2.     1, 2, 3, 4
  3.    2, 4, 6, 8
  4.     0, 2, 4, 6
 Discuss Question
Answer: Option A. ->  0, 1, 2, 3
Question 26. Int len = "jump it!"
  1.    8
  2.    7
  3.    9
  4.    6
 Discuss Question
Answer: Option A. -> 8
Question 27. Which of the following is incorrect?
  1.    int salary = 50_00;
  2.    int salary = 50_000;
  3.    int count = 50.0;
  4.    all of these are incorrect
 Discuss Question
Answer: Option C. -> int count = 50.0;
Question 28. Which of the following for loop declaration is not valid?
  1.    for ( int i = 99; i >= 0; i / 9 )
  2.    for ( int i = 7; i
  3.    for ( int i = 20; i >= 2; - -i )
  4.    for ( int i = 2; i
 Discuss Question
Answer: Option A. -> for ( int i = 99; i >= 0; i / 9 )
Question 29. String s1 = "goat";String s2 = s1
  1.    true
  2.    false
  3.    This code will not compile.
  4.    StringIndexOutOfBoundsException
 Discuss Question
Answer: Option A. -> true
Question 30. How would you declare a variable storing the tax rate?
  1.    int taxRate = 5.1;
  2.    taxRate = "5.1";
  3.    double taxRate = 5.1;
  4.    double taxRate = "5.1";
 Discuss Question
Answer: Option C. -> double taxRate = 5.1;

Latest Videos

Latest Test Papers