Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What will display after the following code is run if name = Morris? if( name > Joe) document.write(Morris is a cat.); else document.write(Joe rules!);

1. What will display after the following code is run if name = "Morris"?

if(name > "Joe")

document.write("Morris is a cat.");

else

document.write("Joe rules!");

a.

Joe rules!

b.

Morris is a cat.

c.

Morris is a cat.Joe rules!

d.

nothing cannot compare these values

2. Which statement is equivalent to the following:

(x >= 0) && (x <= 100)

a.

!(x < 0) && (x > 100)

b.

(x < 0) && (x > 100)

c.

(x >= 0) || (x <= 100)

d.

!((x < 0) || (x > 100))

3. What is the result of the following statement, given that count = 6?

if (count == 6)

a.

true

b.

false

c.

6

d.

not enough information given

4. Which statement is equivalent to the following?

(X > 6)

a.

!(x <= 6)

b.

( x <= 6)

c.

(x < 6 || x == 6

d.

(x < 6 && !(x == 6)

TRUE/FALSE

1. True/False: In an if... structure, the only possible outcomes are either: a block of statements are executed or nothing is executed.

2. True/False: A valid test condition could be (x = 10), assuming x is an integer variable.

3. True/False: The following test condition for an if... structure will be true if x = 2:

if(x < 5 && x > 10)

4. True/False: The result of any test condition is always either true or false.

5. True/False: The following test condition will evaluate to true if x = 5:

if(x < 3 || x == 5)

6. True/False: The following statements are equivalent, given that x = 4 and y = 3:

z = Math.pow(y, x);

and z = x * x * x;

7. True/False: While it is possible to nest an if...else structure within an if... structure, it is not possible to nest an if... structure inside if...else structure.

8. True/False: The if clause and the else clause of an if...else structure must always contain different test conditions.

9. True/False: If an if clause or an else clause contain only one statement, curly brackets are not necessary.

10. True/False: A switch structure is a multiple alternative selection structure.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions