✦ Scientech Easy
Java Variables Quiz Test
📄
15
Questions
⏱
10 min
Time Limit
⭐
4
Marks / Q
−
1
Negative
‣ Read each question carefully before answering.
‣ Use the palette to navigate and bookmark questions.
‣ Wrong answers carry negative marks. Skipped = zero.
‣ The quiz auto-submits when the timer reaches zero.
‣ Stay in fullscreen mode throughout the quiz. Exiting fullscreen is detected and will result in auto-submission.
✦ Scientech Easy
Java Variables Quiz Test
15 Qs
Q 1
1 / 15
0s
What is the default value of an int variable?
null
0
undefined
1
Q 2
2 / 15
0s
Which statement is TRUE about variables in Java?
Variables can be used without declaration.
Variables don’t need data type.
Variables must always be initialized before declaration.
Variables must be declared before use.
Q 3
3 / 15
0s
Which type of variable has block-level scope?
Global variable
Static variable
Instance variable
Local variable
Q 4
4 / 15
0s
Which variable lives as long as the object exists?
Local variable
Static variable
Parameter Variable
Instance variable
Q 5
5 / 15
0s
What is a variable in Java?
A fixed value
A container to store data
A function
A keyword
Q 6
6 / 15
0s
Which of the following statement is TRUE for variables in Java?
Java supports global variables.
All variables are stored in heap.
Local variables are stored in stack.
Static variables are stored in stack.
Q 7
7 / 15
0s
Which keyword is used to define variable scope?
private
protected
public
All of these
Q 8
8 / 15
0s
Which of the following is a valid boolean assignment?
boolean b = “true”;
boolean b = 1;
boolean b = true;
boolean b = 0;
Q 9
9 / 15
0s
Which keyword is used to declare a constant variable?
static
constant
const
final
Q 10
10 / 15
0s
Which variable type is shared among all objects?
Static variable
Local variable
Final variable
Instance variable
Q 11
11 / 15
0s
Which of the following is a valid variable name?
value_1
1value
value-1
class
Q 12
12 / 15
0s
What will be the output of the program?
package methodOverloading;
public class Multiplication
{
void multiply(int a, double b)
{
double m1 = a * b;
System.out.println("Multiplication of two numbers: " +m1);
}
void multiply(double a, int b)
{
double m2 = a * b;
System.out.println("Multiplication of two numbers: " +m2);
}
public static void main(String[] args)
{
Multiplication m = new Multiplication();
m.multiply(10, 20.5); // Calls multiply() to calculate the multiplication of two arguments int and double.
m.multiply(10.5, 30); // Calls multiply() to calculate the multiplication of two arguments double and int.
}
}
22
24
23
21
Q 13
13 / 15
0s
Which variable is created inside a method?
Global variable
Instance variable
Static variable
Local variable
Q 14
14 / 15
0s
What happens if a local variable is not initialized?
It gets default value.
Compilation error
It becomes null.
Runtime error
Q 15
15 / 15
0s
What is the output of the program?
public class Q9 {
public static void main(String[] args) {
int x = 4;
int y = --x + x-- + ++x;
System.out.println(y);
}
}12
13
10
11
Time Left
00 : 10 : 00
Question Palette
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Answered
Bookmarked
Not Visited
Finish Test?
You cannot change responses after submission.
⏱ Time's Up!
Your time is up. The quiz will be submitted.
⚠ Fullscreen Mode Exited
Quiz Complete!
Java Variables Quiz Test
Your Score
Correct
Wrong
Skipped
Total Q
Time Taken


