Development - Java Script - Variables Test

Test Instructions :

1. The Test is 1hr duration.
2. The Test Paper consists of 30 questions. The maximum marks are 30.
3. All the questions are multiple choice question type with three options for each question.
4. Out of the three options given for each question, only one option is the correct answer.
5. Each question is allotted 1 mark for each correct response.
6. 0.25 will be deducted for incorrect response of each question.
Start Test

   Time Left : 00 : 30    : 00

Vriables declared inside function are visible _______________.

  

  

  

  

<!DOCTYPE html>
<html>
    <body>
        <script>
            var num1 = 1;
            var num2 = 1;
            var num3 = "1" + num1 + num2;
            document.write(num1 + "<br>");
            document.write(num2 + "<br>");
            document.write(num3 + "<br>");
        </script>
    </body>
</html>

Guess output of the following code.

  

  

  

  

function message() {
    var name = "Pritesh";
    alert(name);
}

Variable declared above is example of ___________ Variable.

  

  

var num=20;

Above Statement is called as __________ Statement. Select all the appropriate options.

  

  

  

  

var num;

Above Statement is called as __________ Statement.

  

  

  

  

Integer Variable is declared using following syntax in JavaScript.

  

Integer num;

 

  

var num;

 

  

int num;

 

  

integer num;

 

<!DOCTYPE html>
<html>
    <body>
        <script>
            var x = 5;
            var y = 6;
            var z = 5 + 6;
            document.write(x + "<br>");
            document.write(y + "<br>");
            document.write(z + "<br>");
        </script>
    </body>
</html>

Guess output of the following code.

  

5
6
11



  

5
6
56

 

  

5
6
10

 

  

Variable name contain following type of characters -1. Alphabet2. Digits3. Underscore4. Special ChractersSelect the correct option.

  

  

  

  

What will be the value of Variable - "num3" ?

var num1; 
var num2 = 10;
var num3 = num1 + num2;

 

  

  

  

  

Variable declared without a value will have the value ______________.Eg.

var num;

 

  

  

  

undefined

 

  

Non Initialized Variable have value "undefine", What value be printed in following case.

var carname="Volvo"; 
var carname;

 

  

  

  

  

<html>
    <body>
        <script>
            var x = 5;
            var y = 6;
            document.write((x + y) + "<br>");
        </script>
    </body>
</html>

What will be the output of the following code ?

  

  

  

  

Is it necessary to use "var" keyword while declaring variable.

  

  

Local Variables are Destroyed as soon as ______________.

  

  

  

  

<!DOCTYPE html>
<html>
    <body>
        <script>
            var x = "5";
            var y = 6;
            var z = x + y;
            document.write(x + "<br>");
            document.write(y + "<br>");
            document.write(z + "<br>");
        </script>
    </body>
</html>

Guess output of the following code.

  

  

  

  

Underscore can be used as first letter while declaring variable in JavaScript.

  

  

Variable can hold ________ value at a time

  

  

  

  

Multiple Declarations of variables are separated by ___________ symbol

  

  

  

  

var var1 = "Pritesh";

Above variable can store value of type.

  

  

  

  

<script type="text/javascript">
    var name;
    name = "Pritesh";
</script>
<script type="text/javascript">
    document.write(name);
</script>

What will be the output of the following ?

  

  

  

  

What are variables used for in JavaScript Programs?

  

  

  

  

<html>
    <body>
        <script>
            var x = 12.45;
            var y = 1;
            var z = '8' + x + y;
            document.write(z + "<br>");
        </script>
    </body>
</html>

Value of Z is

  

  

  

  

Which JavaScript variable cannot be used as First character but can be use after first character ?

  

  

  

  

<html>
    <body>
        <script>
            var name = "John Doe";
            var name = 123;
            document.write(name + "<br>");
        </script>
    </body>
</html>

Is it possible to change the type of value after re-assignment.

  

  

  

  

Initialization of variable can be done by writing _____ operator in between variable name and operand value.

  

  

  

  

When you assign a text value to a variable, we put text value in the pair of _________.

  

  

  

Variable declared outside JavaScript Function is called as _______________ .

  

  

Java Script Variable should be Case ___________.

  

  

Variable declared inside JavaScript Function will be called as ____________.

  

  

We can declare all type of variables in JavaScript with the keyword _____________.

  

  

  

  

Note:
  • Click the 'Submit Test' button given in the bottom of this page to Submit your answers.
  • Test will be submitted automatically if the time expired.
  • Don't refresh the page.