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.
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
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
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
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”);
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
Question 3 of 15
3. Question
Data value for short ranges between?
CorrectIncorrect -
Question 4 of 15
4. Question
Which of these coding types is used for char data sets that range from 0 to 65536?
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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 );
}
}
CorrectIncorrect -
Question 10 of 15
10. Question
Which of the following programs calculate the area of the rectangle by getting input from the user?
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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 );
}
}
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following is not a signed data type in Java?
CorrectIncorrect -
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));
}
}
CorrectIncorrect -
Question 15 of 15
15. Question
What is the correct way of assigning a value to a float data type variable during the declaration?
CorrectIncorrect
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!
