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.
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
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
Question 3 of 15
3. Question
Data value for short ranges between?
Correct
Incorrect
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
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
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
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
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
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
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
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
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
Question 13 of 15
13. Question
Which of the following is not a signed data type in Java?
Correct
Incorrect
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
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!
You give me 15 seconds I promise you best tutorials Please share your happy experience on Google
DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.