✦ 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
Which of the following is a valid boolean assignment?
boolean b = 1;
boolean b = true;
boolean b = “true”;
boolean b = 0;
Q 2
2 / 15
0s
Which keyword is used to declare a constant variable?
static
const
final
constant
Q 3
3 / 15
0s
Which keyword is used to define variable scope?
All of these
private
public
protected
Q 4
4 / 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.
}
}
24
22
21
23
Q 5
5 / 15
0s
What happens if a local variable is not initialized?
It gets default value.
It becomes null.
Compilation error
Runtime error
Q 6
6 / 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
11
10
Q 7
7 / 15
0s
Which statement is TRUE about variables in Java?
Variables must always be initialized before declaration.
Variables don’t need data type.
Variables can be used without declaration.
Variables must be declared before use.
Q 8
8 / 15
0s
Which variable is created inside a method?
Static variable
Instance variable
Global variable
Local variable
Q 9
9 / 15
0s
What is a variable in Java?
A fixed value
A keyword
A function
A container to store data
Q 10
10 / 15
0s
Which type of variable has block-level scope?
Global variable
Local variable
Instance variable
Static variable
Q 11
11 / 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 12
12 / 15
0s
Which of the following is a valid variable name?
class
1value
value_1
value-1
Q 13
13 / 15
0s
Which variable type is shared among all objects?
Static variable
Instance variable
Local variable
Final variable
Q 14
14 / 15
0s
What is the default value of an int variable?
0
undefined
null
1
Q 15
15 / 15
0s
Which variable lives as long as the object exists?
Static variable
Instance variable
Parameter Variable
Local variable
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


