Site icon DataFlair

Quiz on Java Data Types

quiz on java data types

Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java

Ready to put your Java skills to the test and uncover any knowledge gaps? Dive into this comprehensive quiz designed to challenge your understanding of data types, a fundamental building block of Java programming.

Through a series of interactive multiple-choice questions, you’ll explore various data types, their properties, and how to effectively use them within your code. Whether you’re a beginner solidifying your foundation or an experienced programmer seeking a refresher, this quiz is for you! Let’s test your knowledge.

Time limit: 0

Quiz Summary

0 of 15 Questions completed

Questions:

Information

You have already completed the quiz before. Hence you can not start it again.

Quiz is loading…

You must sign in or sign up to start the quiz.

You must first complete the following:

Results

Quiz complete. Results are being recorded.

Results

0 of 15 Questions answered correctly

Your time:

Time has elapsed

You have reached 0 of 0 point(s), (0)

Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)

Categories

  1. Not categorized 0%
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  1. Current
  2. Review / Skip
  3. Answered
  4. Correct
  5. Incorrect
  1. Question 1 of 15
    1. Question

    What should be the Boolean Value for b to print inside system.out.println?

    class DataFlair {

        public static void main(String args[])

        {

            boolean b = ????;

            if (b == true)

                System.out.println(“Welcome to DataFlair Webservices”);

        }

    }

    Correct
    Incorrect
  2. Question 2 of 15
    2. Question

    What will be the output of the program ?

    class Demo {

        public static void main(String args[])

        {

            byte a = 127;

            System.out.println(a);

            a++;

            System.out.println(a);

            a++;

            System.out.println(a);

            a++;

            System.out.println(a);

        }

    }

    Correct
    Incorrect
  3. Question 3 of 15
    3. Question

    Data value for short ranges between?

    Correct
    Incorrect
  4. Question 4 of 15
    4. Question

    Which of these coding types is used for char data sets that range from 0 to 65536?

    Correct
    Incorrect
  5. Question 5 of 15
    5. Question

    What data type should be assigned to the c variable to expect a desired output?

    class sample {

    public static void main(String args [] ) {

    int a = 3;

    int b = 5;

    _____ c = a/b;

    system.out.println(“The answer is “ + c);

    }

         }

    Correct
    Incorrect
  6. Question 6 of 15
    6. Question

    Which variable is best suited to display time in milliseconds in this program?

     import java.util.*;

     

    public class JavaLongExample {

     

    public static void main(String[] args) {

    **** timeInMilliseconds = new Date().getTime();

    System.out.println(“Time in milliseconds is : ” + timeInMilliseconds);

    }

    }

    Correct
    Incorrect
  7. Question 7 of 15
    7. Question

    What will be the output of the program?

    class demo {

    public static void main(String args [])

    {

    float name = “DataFlair”;

    system.out.println(name);

    }

    }

    Correct
    Incorrect
  8. Question 8 of 15
    8. Question

    What will be the output of the program?

    class datatype {

    public static void main( String args [] )

    {

    int p = 123;

    int q = 114;

    long r = p * q;

    system .out.println(r);

    }

    }

    Correct
    Incorrect
  9. Question 9 of 15
    9. Question

    What is the output of the program?

    class area {

    public static void main (String args []) 

    {

    int r = 3;

    float pi = 3.14;

    int a = pi * r * r;

    system.out.println(“The area of the circle is “ + a );

    }

    }

    Correct
    Incorrect
  10. Question 10 of 15
    10. Question

    Which of the following programs calculate the area of the rectangle by getting input from the user?

     

    Correct
    Incorrect
  11. Question 11 of 15
    11. Question

    Which of the following formulas is correct to calculate the diameter of the circle? 

    class diameter {

    public static void main ( String args [] )

    {

    float radius = 5.69;

    ***************

    system.out.println(“Diameter of the circle is “ + diameter);

    }

    }

    Correct
    Incorrect
  12. Question 12 of 15
    12. Question

    What will be the output of the program?

    Class character {

    Public static void main ( String args [] )

    {

    Char = a,b,c,d,e,f,g,h,i;

    a= 68;

    b = 65;

    c = 84;

    d = 65;

    e = 70;

    f = 76;

    g = 65;

    h = 73;

    i = 82;

    system.out.println(a + b + c + d + e + f + g + h + i );

    }

    }

    Correct
    Incorrect
  13. Question 13 of 15
    13. Question

    Which of the following is not a signed data type in Java?

    Correct
    Incorrect
  14. Question 14 of 15
    14. Question

    What will be the output of the program?

    public class example {

     

            public static void main( String args [] )

           { 

            String str = “welcome”;

            System.out.println(str.charAt(0));

            System.out.println(str.charAt(1));

            System.out.println(str.charAt(2));

            System.out.println(str.charAt(3));

            System.out.println(str.charAt(4));

            System.out.println(str.charAt(5));

            System.out.println(str.charAt(1));

        }

    }

    Correct
    Incorrect
  15. Question 15 of 15
    15. Question

    What is the correct way of assigning a value to a float data type variable during the declaration?

    Correct
    Incorrect

Summary:

Awesome job on finishing the quiz! Answering all those questions is a super way to test your skills with Java’s building blocks, those data types. Programming is all about learning new things all the time, so keep up the great curiosity! There are tons of resources out there to help you keep exploring, like online classes, tutorials, and even fun practice problems.

Don’t be shy about taking this quiz again later – it’s a fantastic way to make sure everything sticks. Java mastery is an incredible journey, and this quiz is just the beginning. Keep practising, keep learning, and have fun along the way!

Exit mobile version