JavaScript Final

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is the proper way to compare if two values are equal in a Boolean expression in JavaScript?

==

What symbol represents the or operator in JavaScript?

| |

How many times will this program print "hello"? var i = 50; while (i < 100) { println l("hello") }

This code will loop infinitely

Which of the following is a good example of a proper constant variable name?

var MAX_VALUE = 100;

Which of the following is NOT a valid value for a Boolean?

Yes

After the following code runs, what is the value of isWeekend? var isSaturday = true; var is Sunday = false; var isWeekend = isSaturday | | isSunday;

True

What statement can we use inside of a loop to end it?

break

What kind of statement allows us to run a block code only if a certain condition is true?

if statement

Which of the following is correct loop and a half structure?

while(true){ //code if(condition){ break; } //code }

What is the proper operator for "not equals" in JavaScript?

!=

What symbol represents the and operator in JavaScript?

&&

How can we check if a variable num is even?

(num % 2 == 0)

How many possible values can be Randomizer.nextBoolean() return?

2

Why do we use constant variables?

All of the above

Which of the following returns a random number between 1 and 10?

Randomizer.nextInt (1, 10)

What is the term for the value hat signals the end of user input?

sentinel

How many times will this program print "hello" var i = 10; while (i > 0) { println("hello"); i—; }

10

Which will be the value of sum after this code runs? var START = 1; var END = 4; function start(){ var sum = 0; for(var i = START; i <= END; i++){ sum += i; } }

10

In the following code, what will be the last number to print to the screen before the program finishes? for (var i = 0; i < 10; i++) { if (i % 2 == 0) { println(i); } else { println(2 * i); } }

18

How many times will the following code print "hello"? for (var i = 0; i < 8; i += 2) { println("hello"); }

4

How many times will the following code print "hello"? for (var i = 3; i < 8; i++) { println("hello"); }

5

How many times will the following program print "hello"? for (var i = 0; i < 5; i++) { println("hello"); }

5

What kind of statement allows us to run one block of code if one condition is true, and a separate block of code otherwise?

if/else statement


संबंधित स्टडी सेट्स

3.2 - Validity and reliability of measurement

View Set

CH 22: Nursing Management of the Postpartum Women at Risk

View Set