Javascript Mixed(Computer Science > Javascript ) Questions and Answers

Question 1. Indicates the beginning and the end of a JavaScript section
Explanation:-
Answer: Option A. ->

Question 2. State the correct place of JS Code inside HTML -
  1.    Inside Body
  2.    Inside Head
  3.    Inside Single JavaScript File
  4.    All of these
Explanation:-
Answer: Option D. -> All of these

Question 3. Assignment Operators is following type of operator ______________
  1.    Binary
  2.    Unary
  3.    Ternary
  4.    None of these
Explanation:-
Answer: Option A. -> Binary

Question 4. Which of the following operator is used for the Assignment Operator?
  1.    ==
  2.    !
  3.    =
  4.    +
Explanation:-
Answer: Option C. -> =

Question 5. Which of the following is NOT a valid component of a function declaration?
  1.    Function keyword
  2.    Function name
  3.    Pair of Square Braces
  4.    Pair of Curly Braces
Explanation:-
Answer: Option C. -> Pair of Square Braces

Question 6. This saves a value, which can be then assigned when writing code
  1.    Parameter
  2.    Function
  3.    Variable
  4.    none of the above
Explanation:-
Answer: Option C. -> Variable

Question 7. Which of the following is the correct syntax to redirect a url using JavaScript?
  1.    document.location='http://www.newlocation.com';
  2.    browser.location='http://www.newlocation.com';
  3.    navigator.location='http://www.newlocation.com';
  4.    window.location='http://www.newlocation.com';
Explanation:-
Answer: Option D. -> window.location='http://www.newlocation.com';

Question 8. Which of the following function of String object returns the index within the calling String object of the first occurrence of the specified value?
  1.    substr()
  2.    search()
  3.    lastIndexOf()
  4.    indexOf()
Explanation:-
Answer: Option D. -> indexOf()

Question 9. Var num;Above Statement is called as __________ Statement
  1.    Instantization
  2.    Globalization
  3.    Declaration
  4.    Initialization
Explanation:-
Answer: Option C. -> Declaration

Question 10. Inside which HTML element do we put the JavaScript?
Explanation:-
Answer: Option C. -> Declaration