Thursday, April 30, 2020

Javascript quiz with questions and answers

JavaScript is a web technology that adds the dynamic nature to the HTML web page. We can build applications from simple apps such as Calculator, Simple Quiz to complex applications such as Gmail, Google Analytics, Google Maps.

There are hundreds of frameworks have been derived from JavaScript and few popularly derived frameworks are NodeJSAngularJSReactJS, Vue JS Meteora JS, Backbone JS, etc. To understand these frameworks.

Take a quiz and assess your level of experience with Javascript tool, if you can score more than 6, then you can start directly with intermediate-level courses by brushing up basics, if your score is below 6, you can start taking a beginners level course, you can refer to the courses.
Javascript quiz with questions and answers
Javascript quiz with questions and answers


Question 1. Choose the correct answers from the below?

A. Javascript is an extension of the Java programming language
B. Javascript is a scripting language but not an object-oriented language
C. Javascript is used for manipulating the DOM(Document Object Model) elements of the HTML WebPage
D. Javascript is used for form validation only on client-side web applications and it cannot be used on server side


Answer: Option C
HTML is used for defining the DOM elements of a webpage and JavaScript is used for accessing and modifying all the elements of an HTML


 Question 2. What is the HTML tag under which one can write the JavaScript code?

A. <javascript> ... </javascript>
B. <scripted> ... </scripted>
C. <script>...  </script>
D. <js> ... </js>


Answer: Option C
Example:
<script> tag is used for defining for the javascript in the HTML web page and you can write the scripts/functions inside the script tags.

Question 3. Javascript is _ language?

Dynamic computer programming language
Javascript is an object-oriented programming language
Javascript is a Scripting language
All the Above


Answer: Option D
Python is a high-level programming language which means humans can easily understand the code. Low-level languages are machine level languages that can be understood by machines. Python is called scripting language because it was an interpreter to translate its source code. It is called a general-purpose programming language because it can be used to build any real-world applications


 Question 4. Predict the output of the following JavaScript code.

<script type="text/javascript" language="javascript"> 
var a = "Topzenith";  
var result = a.substring(4, 5); 
document.write(result);  
</script> 
A. e
B. en
C. n
D. ni

Answer: Option A
Explanation: The substring command selects the substring starting from 4 to 5, excluding the 5th index. The indexing starts from 0. So, the output here is just “s” rather than sf.

Question 5. what is the correct file extension for Javascript files?

A .java
js
C .javascript
D .script


Answer: Option B
All the files should save as .js file extension, in order to run the Javascript scripts.


 Question 6. Which of the following is the correct syntax to display “Topzenith.com” in an alert box using JavaScript?

A. alertbox(“topzenith.com”);
B. 
C. alert(“Topzenith.com”);
D. msg(“topzenith.com”);


Answer : Option C
Explanation: To display any text in the alert box, you need to write it as alert(“topzenith.com”);


 Question 7. What is the difference between "==" and "==="?


B. Both operators are same
C.==" checks only for equality in value whereas "===" is a stricter equality test
D. None of the above

Answer: Option C
==" checks only for equality in value whereas "===" is a stricter equality test and returns false if either the value or the type of the two variables are different. So, the second option needs both the value and the type to be the same for the operands.

 Question 8. What is the output of below? 33 == 33.0

A. False
B. 33
C. True
D. None of the above


Answer: Option C
Explanation
A comparison operator evaluates true and false. 


 Question 9. JavaScript is ________ language?

A. 
B. 
C. Translated
D. None of the above


Answer: Option A
Javascript uses an interpreter to translate and execute the code. The main difference is that the interpreter translates and executes code at once whereas the compiler translates the code into machine level language and then executes the programs. The best examples of the compiler are C, Java. Examples of the interpreter are Javascript, Python, Ruby, Perl programming examples

 Question 10. What will this code print?
>>> a=10
>>> alert(a+10)

A. This code will raise an exception
B. a+10
C. None of these
D. 20


Answer: Option D



Based on your score, if you can score more than 6, then you can start directly with intermediate-level courses by brushing up basics, if your score is below 6, you can start taking a beginners level course, you can refer to the courses. you can refer to the top 10 best Javascript courses online and take the courses accordingly. 


EmoticonEmoticon