Javascript Questions and Answers

Practice Mode
Showing 10 of 78 questions
Q1
<script type="text/javascript"> x=4+"4"; document.write(x); </script> Output------?
  • A 44
  • B 8
  • C 4
  • D Error output
Answer: Option A
Q2
<script type="text/javascript" language="javascript"> var qpt = "Qualiyt Point Technologies"; var result = qpt.split(" "); document.write(result); </script>
  • A Quality
  • B Q,u,a,l,i,t,y,P,o,i,n,t,T,e,c,h,n,o,l,o,g,i,e,s
  • C Qualiyt,Point,Technologies
  • D QualityPointTechnologies
Answer: Option C
Q3
Is it possible to nest functions in JavaScript?
  • A True
  • B False
Answer: Option A
Q4
 <script> document.write(navigator.appCodeName); </script>
  • A get code name of the browser of a visitor
  • B set code name of the browser of a visitor
  • C None of the above
Answer: Option A
Q5
Which of the following is true?
  • A If onKeyDown returns false, the key-press event is cancelled.
  • B If onKeyPress returns false, the key-down event is cancelled.
  • C If onKeyDown returns false, the key-up event is cancelled.
  • D If onKeyPress returns false, the key-up event is canceled.
Answer: Option A
Q6
Scripting language are
  • A High Level Programming language
  • B Assembly Level programming language
  • C Machine level programming language
Answer: Option A
Q7
Which best explains getSelection()?
  • A Returns the VALUE of a selected OPTION.
  • B Returns document.URL of the window in focus.
  • C Returns the value of cursor-selected text
  • D Returns the VALUE of a checked radio input.
Answer: Option C
Q8
<script language="javascript"> function x() { var s= "Good 100%"; var pattern = /\D/g; var output= s.match(pattern); document.write(output); } </script>
  • A Good %
  • B 1,0,0
  • C G,o,o,d,%
  • D Error
Answer: Option C
Q9
<script language="javascript"> var qpt="QUALITY POINT TECHNOLOGIES"; alert(qpt.charAt(qpt.length-1)); </script>
  • A P
  • B E
  • C S
  • D Error
Answer: Option C
Q10
Choose the client-side JavaScript object:
  • A Database
  • B Cursor
  • C Client
  • D FileUpLoad
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test