Question
9. Considering the following code segment: if ( num <0) { alert(It's a negative num.); } else { alert(It's a non-negative num.); } What will
9.
Considering the following code segment:
if ( num <0) {
alert("It's a negative num.");
}
else {
alert("It's a non-negative num.");
}
What will be displayed if num=0?
It's a positive num. | ||||||||||||||
It's a non-negative num. | ||||||||||||||
It's a zero. | ||||||||||||||
Nothing will be displayed.
10. Considering the following code segment: if(x>y) { y=x; } else if (x == y){ x=1000; } else{ y =100; } alert ( 'x=' + x + ', y = '+y); Given x=0 and y=5, what will be displayed?
|
11.
If variable answer stores a Boolean value, then what are the possible values for the variable?
0 or 1 | ||
"true" or "false" | ||
true or false | ||
any value |
12.
Suppose variables roll1 = 3 and roll2 = 4, which of the following will be evaluated as true?
roll1>3 || roll2 > 3 | ||
roll1>3 && roll2 > 3 | ||
!(roll1==3) | ||
roll1>3 || roll2 < 3 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started