Quiz Discussion

What is the range of short data type in Java?

Course Name: Java

  • 1]

    -128 to 127

  • 2]

    -32768 to 32767

  • 3]

    -2147483648 to 2147483647

  • 4]

    None of the mentioned

Solution
No Solution Present Yet

Top 5 Similar Quiz - Based On AI&ML

Quiz Recommendation System API Link - https://fresherbell-quiz-api.herokuapp.com/fresherbell_quiz_api

# Quiz
1
Discuss

What will be the output of the following Java code? - Area Of Circle

public class area {
        public static void main(String args[]) 
        {    
             double r, pi, a;
             r = 9.8;
             pi = 3.14;
             a = pi * r * r;
             System.out.println(a);
        } 
    }

 

  • 1]

    301.5656

  • 2]

    301

  • 3]

    301.56

  • 4]

    301.56560000

Solution
2
Discuss

What will be the output of the following Java code? - Increment / Decrement

public class increment {
   public static void main(String args[]) 
     {        
         int g = 3;
         System.out.print(++g * 8);
     } 
}

 

  • 1]

    25

  • 2]

    24

  • 3]

    32

  • 4]

    33

Solution
3
Discuss

What will be the output of the following Java code? - Average

public class average {
   public static void main(String args[])
     {
         double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
         double result;
         result = 0;
         for (int i = 0; i < 6; ++i) 
         {
           result = result + num[i];
         } 
	    System.out.print(result/6);
 
      } 
  }

 

  • 1]

    16.34

  • 2]

    16.566666644

  • 3]

    16.46666666666667

  • 4]

    16.46666666666666

Solution
4
Discuss

What will be the output of these statement?

public class output {
        public static void main(String args[]) 
        {
            double a, b, c;
            a = 3.0/0;
            b = 0/4.0;
            c = 0/0.0;
 
	        System.out.println(a);
            System.out.println(b);
            System.out.println(c);
        } 
    }

 

  • 1]

    Infinity

  • 2]

    0.0

  • 3]

    NaN

  • 4]

    all of the mentioned

Solution
5
Discuss

Which of the following is the advantage of BigDecimal over double?

  • 1]

    Syntax

  • 2]

    Memory usage

  • 3]

    Garbage creation

  • 4]

    Precision

Solution
6
Discuss

Which of these literals can be contained in float data type variable?

  • 1]

    -1.7e+308

  • 2]

    -3.4e+038

  • 3]

    +1.7e+308

  • 4]

    -3.4e+050

Solution
7
Discuss

Which of the following are legal lines of Java code?

   1. int w = (int)888.8;
   2. byte x = (byte)100L;
   3. long y = (byte)100;
   4. byte z = (byte)100L;
  • 1]

    1 and 2

  • 2]

    2 and 3

  • 3]

    3 and 4

  • 4]

    All statements are correct

Solution
8
Discuss

What is the range of byte data type in Java?

  • 1]

    -128 to 127

  • 2]

    -32768 to 32767

  • 3]

    -2147483648 to 2147483647

  • 4]

    None of the mentioned

Solution
9
Discuss

Which of these values can a boolean variable contain?

  • 1]

    True & False

  • 2]

    0 & 1

  • 3]

    Any integer value

  • 4]

    True

Solution
10
Discuss

An expression involving byte, int, and literal numbers is promoted to which of these?

  • 1]

    float

  • 2]

    byte

  • 3]

    long

  • 4]

    int

Solution
# Quiz