/  JavaScript-conditional-statements-Quiz

This Quiz contains totally 10 Questions each carry 1 point for you.

1. A conditional expression is also called a
Alternative to if-else
Immediate if
if-then-else statement
Switch statement

Correct!

Wrong!

2. What will be the output of the following JavaScript code?

if (10 > 5) {

var outcome = "if block";

}​

outcome;
10
5
"if block"
None

Correct!

Wrong!

3. What will be the output of the following JavaScript code?

if ("cat" === "dog") {

var outcome = "if block";

} else {

var outcome = "else block";

}

outcome;
"If bloack"
"else block"
Both A and B
None

Correct!

Wrong!

4. A statement block is a
conditional block
block that contains a single statement
both conditional block and a single statement
block that combines multiple statements into a single compound statement

Correct!

Wrong!

5. JavaScript Statements are executed by
JVM
Browser
Compiler
Server

Correct!

Wrong!

6. 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);
10
9
8
0

Correct!

Wrong!

7. 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);
10
27
8
0

Correct!

Wrong!

8. Following JS Code Consists of different Type of Statements ?

<script type="text/javascript">

var i = 10;

if (i < 10) {

document.write("<h1>This is a heading</h1>");

document.write("<p>This is a paragraph.</p>");

document.write("<p>This is another paragraph.</p>");

}

</script>
Assignment Statement
Executable Statement
Declaration Statement
Conditional Statement
All Type of Statements are included inside JS Code

Correct!

Wrong!

9. Multiple JS statements are written inside pair of ________ to form a statement block.
Pair of Round Brackets
Pair of Curly braces
None of these
Pair of Square Brackets

Correct!

Wrong!

10. What will be the output of the following JavaScript code?

Int a=1;

if(a>10)

{

document.write(10);

}

else

{

document.write(a);

}
10
0
1
Undefined

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

Javascript – Cond. Statements – Quiz

You got %%score%% of %%total%% right

%%description%%

%%description%%

Where to go ?

Quizzes

Loading...