Page 97 - PortGPT_V2.1_C8_Flipbook
P. 97
2. Fill in the blanks using the words from the help box.
false, if, switch, else
a. The ____________ statement is the simplest conditional statement.
b. The ____________ statement executes certain statements depending on user's choice.
c. Decision statements may give the results true or ____________.
d. The ____________ block will be executed if and only if the provided condition evaluates to
false.
3. Write 'T' for true and 'F' for false.
a. The if…else statement is the simplest conditional statement. ___
b. JavaScript does not allow nested if statement. ___
c. The if statement executes a command if the provided condition evaluates to true. ___
d. The Switch statement allows you to test multiple conditions. ___
4. Short answer type questions.
a. What is decision making statement?
_
_
_
______________________________________________________________________________
b. Write the syntax for the Switch statement.
_
_
_
______________________________________________________________________________
c. Write the syntax of the if statement.
______________________________________________________________________________
_
_
_
5. Long answer type questions.
a. Draw the flowchart for nested if statement.
b. Write a JavaScript program to convert centimeters to inches. Hint: 1 inch = 2.54 cms.
fun Zone
Let's soLve
What will be the output of the following programs:
1. var a = 26;
var b = 35;
if(a > b)
{
document.write("First number is greater then second number");
}
else
{
Conditional Statements in JavaScript 95

