Sail E0 Webinar

MCQs

Total Questions : 26 | Page 1 of 3 pages
Question 1. Java is a ........... language.
  1.    moderate typed
  2.    strongly typed
  3.    weakly typed
  4.    None of these
 Discuss Question
Answer: Option B. -> strongly typed
Question 2. Size of int in Java is
  1.    32 bit
  2.    16 bit
  3.    64 bit
  4.    Depends on execution environment
 Discuss Question
Answer: Option A. -> 32 bit
Question 3. The smallest integer type is ......... and its size is ......... bits.
  1.    byte, 8
  2.    short, 16
  3.    short, 16
  4.    short, 8
 Discuss Question
Answer: Option A. -> byte, 8
Question 4. In Java byte, short, int and long all of these are
  1.    None of these
  2.    signed
  3.    unsigned
  4.    Both of the above
 Discuss Question
Answer: Option B. -> signed
Question 5. How many primitive data types are there in Java?
  1.    9
  2.    7
  3.    6
  4.    8
 Discuss Question
Answer: Option D. -> 8
Question 6. Size of float and double in Java is
  1.    32 and 64
  2.    32 and 32
  3.    64 and 64
  4.    64 and 32
 Discuss Question
Answer: Option A. -> 32 and 64
Question 7. Determine output:public class Test { static void test(float x){ System.out.print("float"); } static void test(double x){ System.out.print("double"); } public static void main(String[] args){ test(99.9); }}
  1.    Compilation Error
  2.    Exception is thrown at runtime
  3.    double
  4.    float
 Discuss Question
Answer: Option C. -> double
Question 8. Which of the following automatic type conversion will be possible?
  1.    int to long
  2.    short to int
  3.    long to int
  4.    byte to int
 Discuss Question
Answer: Option A. -> int to long
Question 9. Determine output:class A{ public static void main(String args[]){ int x; x = 10; if(x == 10){ int y = 20; System.out.print("x and y: "+ x + " " + y); y = x*2; } y = 100; System.out.print("x and y: " + x + " " + y); }}
  1.    Error
  2.    10 20 10 100
  3.    10 20 10 10
  4.    10 20 10 20
 Discuss Question
Answer: Option A. -> Error
Question 10. Automatic type conversion in Java takes place when
  1.    Two type are compatible and size of destination type is equal of source type.
  2.    Two type are compatible and size of destination type is larger than source type.
  3.    All of these
  4.    Two type are compatible and size of destination type is shorter than source type.
 Discuss Question
Answer: Option B. -> Two type are compatible and size of destination type is larger than source type.

Latest Videos

Latest Test Papers