JavaScript Course | Practice Quiz-2 JavaScript Course Quiz 2 Please wait while the activity loads. If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled. If loading fails, click here to try again Question 1Which of the following javascript functions allows you to get user input data?alertpromptconfirmNone of the aboveJavaScript Course Quiz 2 Discuss itQuestion 1-Explanation: Only prompt creates an input field where the user can enter the data.Question 2Which logical operator only accepts a single operand?&&(AND)||(OR)!(NOT)None of the aboveJavaScript Course Quiz 2 Discuss itQuestion 2-Explanation: Only the !(NOT) operator takes a single operand. It flips the value.Question 3What will be the result of the following code? <script> document.write( true && 1 && 3); </script> 01true3JavaScript Course Quiz 2 Discuss itQuestion 3-Explanation: The && (and operator) returns the last (right-side) value as long as the chain is \"truthy\" or True.Question 4What will be the output of the following code? <script> document.write((0 && 1) || (1 || 0)); </script> 0falsetrue1JavaScript Course Quiz 2 Discuss itQuestion 4-Explanation: The && (and operator) returns the last (right-side) value as long as the chain is \"truthy\". The || (or operator) returns true if either of the value is true.Question 5What will be the output of the following code? <script> let ans = 0 / 0; document.write(ans); </script> 0infinityNaNNone of the aboveJavaScript Course Quiz 2 Discuss itQuestion 5-Explanation: 0/0 is undefined for the real number and is therefore represented by NaN (Not a Number) in Javascript.Question 6What will be the output of the following code? <script> let i = 30; if( i == 10 || i > 20){ console.log('Hola'); }else if( i == 5){ console.log('Breaking up the code'); }else{ console.log('Adios'); } </script> HolaBreaking up the codeAdiosNone of the aboveJavaScript Course Quiz 2 Discuss itQuestion 6-Explanation: The if() statement will be executed if the condition in the bracket returns true otherwise the else statement is executed.Question 7What will be the output of the following code? <script> let ans = 1; document.write( ans === '1'); </script> truefalse0None of the aboveJavaScript Course Quiz 2 Discuss itQuestion 7-Explanation: The strict equality operator compares both the value and the type of the operands.Question 8What will be the output of the following code? <script> let age = 20; let result = age>18 ? 'Great' : 'Not so great'; document.write(result); </script> GreatNot so greattrueNone of the aboveJavaScript Course Quiz 2 Discuss itQuestion 8-Explanation: ?: is a ternary operator which will return the value after \'?\' if true else it will return the value after \':\'.Question 9 What will be the output of the following code? <script> let y = 1; y = typeof x; document.write(typeof y); </script> stringnullnumberbooleanJavaScript Course Quiz 2 Discuss itQuestion 9-Explanation: typeof \'undefined\' is a string and if we do typeof \'string\' again it will be the same.Question 10What will be the output of the following code? <script> var x = [typeof x, typeof y][1]; document.write(typeof typeof x); </script> undefinedstringnumberbooleanJavaScript Course Quiz 2 Discuss itQuestion 10-Explanation: typeof \'y\' which is undefined returns \'undefined\', typeof \'undefined\' is \'string\', and another typeof on it still returns \'string\'. 1 There are 10 questions to complete. You have completed questions question Your accuracy is Correct Wrong Partial-Credit You have not finished your quiz. If you leave this page, your progress will be lost. Correct Answer You Selected Not Attempted Final Score on Quiz Attempted Questions Correct Attempted Questions Wrong Questions Not Attempted Total Questions on Quiz Question Details Results Date Score Hint Time allowed minutes seconds Time used Answer Choice(s) Selected Question Text All doneNeed more practice!Keep trying!Not bad!Good work!Perfect! Last Updated : 27 Sep, 2023 Share your thoughts in the comments Add Your Comment Please Login to comment...