49). JavaScript is a _______________ language.

[A]Object-Oriented
[B]High-level
[C]Assembly-language
[D]Object-Based

Show Answer

50). What will be the output of the following JavaScript code?
var a=5 , b=1
var obj = { a : 10 }
with(obj) 
{
      alert(b)
}

[A]10
[B]Error
[C]1
[D]5

Show Answer

51). A conditional expression is also called a _______________
var a=5 , b=1
var obj = { a : 10 }
with(obj) 
{
      alert(b)
}

[A]Alternative to if-else
[B] Immediate if
[C]If-then-else statement
[D]Switch statement

Show Answer

52). Which is a more efficient JavaScript code snippet?
Code 1 :

for(var num=10;num>=1;num--)
{
           document.writeln(num);
}Code 2 :var num=10;
while(num>=1)
{
       document.writeln(num);
       num++;
}

[A]Code 1
[B]Code 2
[C]Both Code 1 and Code 2
[D]Cannot Compare

Show Answer

53). What is a block statement in JavaScript?
Code 1 :

for(var num=10;num>=1;num--)
{
           document.writeln(num);
}Code 2 :var num=10;
while(num>=1)
{
       document.writeln(num);
       num++;
}

[A]conditional block
[B] block that contains a single statement
[C]both conditional block and a single statement
[D] block that combines multiple statements into a single compound statement

Show Answer

54). When an empty statement is encountered, a JavaScript interpreter __________
Code 1 :

for(var num=10;num>=1;num--)
{
           document.writeln(num);
}Code 2 :var num=10;
while(num>=1)
{
       document.writeln(num);
       num++;
}

[A] Ignores the statement
[B]Prompts to complete the statement
[C]Throws an error
[D]Shows a warning

Show Answer

55). The “var” and “function” are __________
Code 1 :

for(var num=10;num>=1;num--)
{
           document.writeln(num);
}Code 2 :var num=10;
while(num>=1)
{
       document.writeln(num);
       num++;
}

[A]Keywords
[B]Declaration statements
[C]Data types
[D]Prototypes

Show Answer

56). In the following switch syntax, the expression is compared with the case labels using which of the following operator(s)?
switch(expression)
{
    statements
}

[A]==
[B]equals
[C]equal
[D]===

Show Answer

57). What happens in the following javaScript code snippet?
var count = 0;
while (count < 10) 
{
     console.log(count);
     count++;
}

[A]The values of count are logged or stored in a particular location or storage
[B]The value of count from 0 to 9 is displayed in the console
[C]An error is displayed
[D]An exception is thrown

Show Answer

58). The enumeration order becomes implementation dependent and non-interoperable if ___________
var count = 0;
while (count < 10) 
{
     console.log(count);
     count++;
}

[A] If the object inherits enumerable properties
[B]The object does not have the properties present in the integer array indices
[C]The delete keyword is never used
[D]Object.defineProperty() is not used

Show Answer

59). What will be the output of the following JavaScript code?
Int a=1;
if(a>10)
{  
    document.write(10);  
} 
else
{
    document.write(a);  
}

[A]10
[B]0
[C]1
[D]Undefined

Show Answer

60). What will be the output of the following JavaScript code?
var grade='B';  
var result;  
switch(grade)
{  
    case 'A':
    {  
        result+="10"; 
        break;
    } 
    case 'B':
    {  
        result+=" 9";
        break;
    }  
    case 'C':
    {  
        result+=" 8";
        break;
    }  
    default:  
    result+=" 0";  
}  
document.write(result);

[A]10
[B]9
[C]8
[D]0

Show Answer

61). What will be the output of the following JavaScript code?
var grade='A';  
var result;  
switch(grade)
{  
    case 'A':  
        result+="10";  
    case 'B':  
        result+=" 9";  
    case 'C':  
        result+=" 8";  
    default:  
        result+=" 0";  
}  
document.write(result);

[A]10
[B]27
[C]8
[D]0

Show Answer

62). What will be the output of the following JavaScript code?
int a=4;
int b=1;
int c=0;
If(a==b)
    document.write(a);
else if(a==c)
    document.write(a);
else
    document.write(c);

[A]4
[B]1
[C]Error
[D]0

Show Answer

63). What will be the output of the following JavaScript code?
var grade='E';  
var result;  
switch(grade)
{  
    case 'A':  
        result+="10";  
    case 'B':  
        result+=" 9";  
    case 'C':  
        result+=" 8";  
    default:  
        result+=" 0";  
}  
document.write(result);

[A]10
[B]0
[C]18
[D]17

Show Answer