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


