- Java Tutorial
- Java Object Oriented
Random Math Quiz program with Java. Ask Question 2. I am trying to create a random math quiz program (numbers are supposed to be between 0 and 20). Make Calculator. To make a simple calculator in Java Programming which performs the basic four mathematical operations i.e., addition, subtraction, multiplication, and division, use the switch case to identify the input operator to perform required calculation and then display the result on the screen as shown in the following program.
- Java Advanced
- Java Useful Resources
- Selected Reading
Following quiz provides Multiple Choice Questions (MCQs) related to Core Java. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - What is the size of byte variable?
Answer : A
Explaination
The byte data type is represented by an 8-bit signed two's complement integer.
Minimum value: -128
Maximum value: 127
Q 2 - What is the size of boolean variable?
Answer : B
Explaination
The boolean data type can take either true or false, but its 'size' isn't precisely defined.
Q 3 - What is the default value of char variable?
Answer : A
Explaination
char variable has default value of 'u0000' if defined as an instance/static variable.
Q 4 - What is polymorphism?
Answer : B
Explaination
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.
Q 5 - What is class variable?
Answer : A
Explaination
Class variables are variables declared with in a class, outside any method, with the static keyword.
Q 6 - What is TreeSet Interface?
Math Quiz Java Program
Answer : B
Explaination
TreeSet is a Set implemented when we want elements in a sorted order.
Q 7 - What is composition?
Answer : C
Explaination
Holding the reference of the other class within some other class is known as composition. It represents a HAS-A relationship. For example, a Student has a Pen. Here Student class has Pen as its instance variable.
Q 8 - What is Deserialization?
Answer : A
Explaination
Create A Quiz Program In Java Free
Deserialization is the process of restoring state of an object from a byte stream.
Q 9 - Deletion is faster in LinkedList than ArrayList.
Java Quiz Code
Answer : A
Online Quiz Program In Java
Explaination
Deletion in linked list is fast because it involves only updating the next pointer in the node before the deleted node and updating the previous pointer in the node after the deleted node.
Q 10 - which operator is considered to be with highest precedence?
Answer : A
Explaination
Postfix operators i.e () [] . is at the highest precedence.