Development - Java Script - Variables Question And Answers

Variable can hold ________ value at a time

A.  Single

B.  Multiple

C.  Double

D.  None of these

View Answer  

We can declare ___________ at a time. Select most appropriate option.

A.  One Variable Only

B.  More than One Variables

C.  One or more Variables

D.  None of these

View Answer  

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

A.  var

B.  jvar

C.  obj

D.  None of these

View Answer  

Spaces,Punctuation marks are called as __________ Symbols in JavaScript.

A.  Special

B.  Punctual

C.  Mandetory

D.  None of these

View Answer  

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

A.  Asterisk

B.  Dollar Sign

C.  Underscore

D.  Digit

View Answer  

Java Script Variable should be Case ___________.

A.  Sensitive

B.  Non Sensitive

C.  

D.  

View Answer  

var num; Above Statement is called as __________ Statement.

A.  Instantization

B.  Globalization

C.  Declaration

D.  Initialization

View Answer  

var num=20; Above Statement is called as __________ Statement. Select all the appropriate options.

A.  Declaration/Initialization

B.  Globalization

C.  Instatiation

D.  None of these

View Answer  

Integer Variable is declared using following syntax in JavaScript.

A.  Integer num;  

B.  var num;  

C.  int num;  

D.  integer num;  

View Answer  

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

A.  3 4 2

B.  4 3 1

C.  1 2 3 4

D.  1 2 3

View Answer  

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

A.  VALUE

B.  ==

C.  EQUALS

D.  =

View Answer  

Multiple Declarations of variables are separated by ___________ symbol

A.  Semicolon

B.  Colon

C.  Comma

D.  Asterisk

View Answer  

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

A.  False

B.  True

C.  

D.  

View Answer  

var var1 = "Pritesh"; Above variable can store value of type.

A.  String

B.  Any Type

C.  Integer

D.  None of these

View Answer  

var x = 5; var y = 6; var z = 5 + 6; document.write(x + ""); document.write(y + ""); document.write(z + ""); Guess output of the following code.

A.  5 6 11

B.  5 6 56  

C.  5 6 10  

D.  Error

View Answer  

var x = "5"; var y = 6; var z = x + y; document.write(x + ""); document.write(y + ""); document.write(z + ""); Guess output of the following code.

A.  5 6 11

B.  5 6 10

C.  5 6 56

D.  None of These

View Answer  

Variable declared without a value will have the value ______________.Eg. var num;  

A.  0

B.  null

C.  undefined  

D.  None of these

View Answer  

var num1 = 1; var num2 = 1; var num3 = "1" + num1 + num2; document.write(num1 + ""); document.write(num2 + ""); document.write(num3 + ""); Guess output of the following code.

A.  1 1 3

B.  1 1 12

C.  1 1 111

D.  None of these

View Answer  

var x = 12.45; var y = 1; var z = '8' + x + y; document.write(z + ""); Value of Z is

A.  21.450

B.  21.451

C.  812.451

D.  813.451

View Answer  

var name = "John Doe"; var name = 123; document.write(name + ""); Is it possible to change the type of value after re-assignment.

A.  Yes !! It is possible.

B.  It can be possible if variable is assigned with interger value.

C.  No

D.  None of these

View Answer  

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

A.  Yes

B.  No

C.  

D.  

View Answer  

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

A.  Single/Double Quote

B.  Square Bracket

C.  None of these

D.  

View Answer  

Non Initialized Variable have value "undefine", What value be printed in following case. var carname="Volvo"; var carname;  

A.  undefined

B.  Error

C.  Volvo

D.  null

View Answer  

What will be the value of Variable - "num3" ? var num1; var num2 = 10; var num3 = num1 + num2;  

A.  10

B.  undefine10

C.  undefine

D.  None of these

View Answer  

var x = 5; var y = 6; document.write((x + y) + ""); What will be the output of the following code ?

A.  56

B.  Error

C.  No Output

D.  11

View Answer  

Variable declared inside JavaScript Function will be called as ____________.

A.  Global Variables

B.  Local Variables

C.  

D.  

View Answer  

Vriables declared inside function are visible _______________.

A.  Inside the function in which it is declared

B.  to all the functions

C.  All the scripts inside save JS File

D.  None of these

View Answer  

Local Variables are destroyed after execution of function.

A.  False

B.  True

C.  

D.  

View Answer  

function message() { var name = "Pritesh"; alert(name); } Variable declared above is example of ___________ Variable.

A.  Global

B.  Local

C.  

D.  

View Answer  

Variable declared outside JavaScript Function is called as _______________ .

A.  Global Variable

B.  Local Variable

C.  

D.  

View Answer