Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the next two questions, consider the following JavaScript code segment var w

ID: 3698875 • Letter: F

Question

For the next two questions, consider the following JavaScript code segment var wordprompt ("Enter a word") if( word.length > 10) console.log ("Wow, big word.") elsef ?E( word.length 6) ( console.log ("Use that word on the SAT.") elsef console.log("I've never heard that before.") 16. If the above code segment is run, and "hello" is entered at the prompt, what will be displayed in the console? a. Wow, big word. b. Did you say something? That was so short. c. Use that word on the SAT. d. I've never heard that before. e. Nothing will be printed 17. If the above code segment is run, and "goodbye" is entered into the prompt, what will be displayed in the console? a. Wow, big word. b. Did you say something? That was so short. c. Use that word on the SAT d. I've never heard that before. e. Nothing will be printed.

Explanation / Answer

1.Answer is D.
If Hello is entered as input then word.length will be calulated.
so the length is 5.
it will check for the condition(word.length is greater than 10), it fails and moves to else condition.
Here it will check another conditiom(word.length is lesser than 3), it fails and moves to next condition
In the next condition it will check for(word.length is greater than 6 ) it again fails as the word.length is 5.
so, "I've never heard that before" will be displayed in the console.

2. Answer is C.
If goodbye is entered as input then word.length will be calulated.
so the length is 7.
it will check for the condition(word.length is greater than 10), it fails and moves to else condition.
Here it will check another condition(word.length is lesser than 3), it fails and moves to next condition
In the next condition it will check for(word.length is greater than 6 ) and it satisfies the condition as the length is greater than 6.
so, "Use that word on the SAT." will be displayed in the console.