Scripting And Interactive Contents

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Hemanshu Chourasia
H
Hemanshu Chourasia
Community Contributor
Quizzes Created: 1 | Total Attempts: 47
Questions: 30 | Attempts: 47

SettingsSettingsSettings
Scripting And Interactive Contents - Quiz


Questions and Answers
  • 1. 

    Difference between == and ===

  • 2. 

    JavaScript is which type of programming language

    • A.

      Interpreted Language

    • B.

      Compiled language

    • C.

      Pre-Compiled Language

    • D.

      Programming Language

    Correct Answer
    A. Interpreted Language
    Explanation
    JavaScript is an interpreted language because it is executed line by line at runtime, without the need for a separate compilation step. The JavaScript code is interpreted by the browser or the JavaScript engine, which reads and executes the code directly. This allows for immediate feedback and dynamic behavior, as changes to the code can be seen and executed instantly. Unlike compiled languages, which require the code to be compiled into machine code before execution, JavaScript does not go through a compilation process.

    Rate this question:

  • 3. 

    This javascript function generates a random number in range of 0 to 100

    • A.

      Math.random()

    • B.

      Math.random() * 100

    • C.

      Math.floor((Math.random() * 100) + 1);

    • D.

      Math.random(100) 

    Correct Answer
    A. Math.random()
    Explanation
    The Math.random() function in JavaScript generates a random decimal number between 0 and 1. By multiplying it by 100, Math.random() * 100 gives a random decimal number between 0 and 100. Math.floor((Math.random() * 100) + 1) further rounds down this decimal number to the nearest whole number, giving a random integer between 1 and 100. Therefore, the correct answer is Math.random().

    Rate this question:

  • 4. 

    The following are used to repeat a same line multiple times

    • A.

      For

    • B.

      Repeat

    • C.

      Loop

    • D.

      While

    Correct Answer(s)
    A. For
    D. While
    Explanation
    The "for" and "while" loops are used to repeat a same line or block of code multiple times in programming. The "for" loop is typically used when the number of iterations is known beforehand, and it consists of an initialization, a condition, and an increment/decrement statement. The "while" loop is used when the number of iterations is not known beforehand, and it continues as long as a specified condition is true. Both loops are essential in controlling the flow of execution and automating repetitive tasks in programming.

    Rate this question:

  • 5. 

    The execution priority of for loop is 

    • A.

      Incrementation Initialization Condition

    • B.

      Condition Incrementation Initialization

    • C.

      Initialization Condition Incrementation

    • D.

      Condition Initialization Incrementation

    Correct Answer
    C. Initialization Condition Incrementation
    Explanation
    In a for loop, the initialization step is performed first, where the loop variable is initialized. Then, the condition is checked to determine whether the loop should continue executing or not. If the condition is true, the loop body is executed, and finally, the incrementation step is performed to update the loop variable. Therefore, the correct execution priority of a for loop is Initialization, Condition, Incrementation.

    Rate this question:

  • 6. 

    If you do not define Condition in while loop it will run for ________ number of times.

    Correct Answer
    infinite
    Explanation
    If the condition in a while loop is not defined, it means that there is no condition to check for the loop to stop. As a result, the loop will continue running indefinitely, hence the term "infinite". Without a condition to evaluate, the loop will not have any stopping criteria, causing it to repeat endlessly until it is manually interrupted or the program is terminated.

    Rate this question:

  • 7. 

    What is used for incrementation

    • A.

      Number++

    • B.

      Number = number++

    • C.

      Number = number +1

    • D.

      Number --

    Correct Answer(s)
    A. Number++
    B. Number = number++
    C. Number = number +1
    Explanation
    The incrementation operator "number++" is used to increase the value of a variable by 1. "number = number++" is an incorrect statement as it does not increment the value of the variable. "number = number +1" is a correct way to increment the value of the variable by 1. "number--" is a decrementation operator that decreases the value of the variable by 1.

    Rate this question:

  • 8. 

    A variable of the following names: break, case, char, continue, delete, double, final, long, new, public, super   can be made

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given variable names: break, case, char, continue, delete, double, final, long, new, public, super, cannot be made because they are reserved keywords in programming languages like Java. These keywords have special meanings and are used for specific purposes in the language syntax. Therefore, using them as variable names would result in a syntax error.

    Rate this question:

  • 9. 

    The following command is used to to take input from the user in JavaScript

    • A.

      Alert()

    • B.

      Prompt()

    • C.

      Input()

    • D.

      Enter()

    Correct Answer
    B. Prompt()
    Explanation
    The correct answer is "Prompt()". The Prompt() function is used in JavaScript to display a dialog box that prompts the user for input. It allows the user to enter a value and returns that value as the result. This function is commonly used to gather user input in order to perform specific actions or make decisions within a JavaScript program.

    Rate this question:

  • 10. 

    A variable name can start with the number

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    In programming, a variable name cannot start with a number. Variable names must start with a letter or an underscore. This is because numbers are reserved for representing numerical values and cannot be used as the first character of a variable name. Using a number as the first character of a variable name would result in a syntax error.

    Rate this question:

  • 11. 

    The 2 types of boolean values are ________ and [Blank________]

    Correct Answer
    true
    false
    Explanation
    The given question is asking for the two types of boolean values. The correct answer states that the two types are "true" and "false." In programming, boolean values are used to represent the truth or falsity of a condition. "True" represents a true or positive condition, while "false" represents a false or negative condition. These two boolean values are commonly used in programming languages to control the flow of code and make decisions based on certain conditions.

    Rate this question:

  • 12. 

    var a = "5"; var b = 5; var sum = a + b; console.log(sum); The output of the Above code is ________

    Correct Answer
    55
    Explanation
    The output of the code is "55" because the variable 'a' is a string containing the character '5', and the variable 'b' is a number with the value 5. When we use the '+' operator to concatenate a string and a number, JavaScript converts the number to a string and then concatenates the two strings together. In this case, the number 5 is converted to the string "5", and then the two strings are concatenated to form "55".

    Rate this question:

  • 13. 

    var a = 5; var b = 5; var sum = a + b; console.log(sum); The output of the Above code is ________

    Correct Answer
    10
    Explanation
    The given code declares two variables, "a" and "b", and assigns the value 5 to both of them. Then, it calculates the sum of "a" and "b" using the "+" operator and assigns the result to the variable "sum". Finally, it logs the value of "sum" to the console. Since both "a" and "b" have the same value of 5, the sum of the two variables is 10. Therefore, the output of the code is 10.

    Rate this question:

  • 14. 

     ________ symbol is used to write single line comment.

    Correct Answer
    //
    Explanation
    The answer is "//" because it is the symbol used to write a single line comment in many programming languages. A single line comment is a piece of code that is ignored by the compiler or interpreter and is used to add notes or explanations to the code for better understanding. The "//" symbol indicates that everything after it on the same line is a comment and will not be executed as part of the code.

    Rate this question:

  • 15. 

    Javascript is Server Side Execution Language

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    JavaScript is primarily a client-side scripting language, meaning it is executed on the user's web browser rather than on the server. It is used to enhance the functionality of websites by adding interactivity and dynamic elements. While JavaScript can also be used on the server side with technologies like Node.js, it is not primarily a server-side execution language.

    Rate this question:

  • 16. 

    In Javascript the value of  20 % 7 is  ________

    Correct Answer
    6
    Explanation
    The given expression "20 % 7" in JavaScript calculates the remainder when 20 is divided by 7. In this case, the remainder is 6.

    Rate this question:

  • 17. 

    Importance of responsive design :

    • A.

      Better ranking (SEO)

    • B.

      It makes it responsible

    • C.

      Works good on All type of screen

    • D.

      Makes screen good look

    Correct Answer(s)
    A. Better ranking (SEO)
    C. Works good on All type of screen
    Explanation
    Responsive design is important because it improves the ranking of a website in search engine results. This is because search engines prioritize websites that are mobile-friendly and provide a good user experience across all devices. Additionally, responsive design ensures that a website works well on all types of screens, including desktops, laptops, tablets, and smartphones. This enhances the overall user experience and increases the chances of users staying on the website for longer periods.

    Rate this question:

  • 18. 

    @media  is used to make the screen ______________________

    • A.

      Play Media

    • B.

      Add Media

    • C.

      Show Media

    • D.

      Responsive

    Correct Answer
    D. Responsive
    Explanation
    The @media rule in CSS is used to apply different styles to different devices or screen sizes. By using @media, we can make the screen responsive, meaning that the layout and design of the webpage will adjust and adapt to different screen sizes, such as desktops, tablets, and mobile devices. This ensures that the webpage is easily viewable and usable on various devices, providing a better user experience.

    Rate this question:

  • 19. 

    _______________ fade { from {background-color: yellow;} /* OR 0% {all properties} */ to {background-color: red;} /* OR 100% {all properties} */ } code is used for animation.. What should come in the blank space

    • A.

      @animation

    • B.

      @keyframes

    • C.

      @media

    • D.

      @move

    Correct Answer
    B. @keyframes
    Explanation
    The code provided is used for creating animations in CSS. The @keyframes rule is used to define the animation by specifying the styles that should be applied at different points in time. It allows you to specify the starting and ending points of the animation, as well as any intermediate steps. In this case, the animation is named "fade" and it gradually changes the background color from yellow to red.

    Rate this question:

  • 20. 

    ________ tag is used for adding music

    • A.

      <music>

    • B.

      <sound>

    • C.

      <audio>

    • D.

      <video>

    Correct Answer
    C. <audio>
    Explanation
    The correct answer is . The tag is specifically used for adding music to a webpage. It allows the user to embed audio content, such as music or sound effects, directly into the HTML document. This tag supports various audio formats and provides controls for playback, volume adjustment, and more.

    Rate this question:

  • 21. 

    Which tags are used to make progress bar in HTML 

    • A.

      <meter>

    • B.

      <bar>

    • C.

      <progress>

    • D.

      <map>

    Correct Answer(s)
    A. <meter>
    C. <progress>
    Explanation
    The correct answer is and . These are the tags used to create a progress bar in HTML. The tag represents a scalar measurement within a known range, while the tag represents the progress of a task. Both tags can be used to visually display the progress of a process or task on a webpage.

    Rate this question:

  • 22. 

    Inside which HTML element do we put the JavaScript? Next ❯

    • A.

      <js>

    • B.

      <script>  

    • C.

      <scripting>

    • D.

      <javascript>

    Correct Answer
    C. <scripting>
  • 23. 

    What is the correct JavaScript syntax to change the content of the HTML element below? <p id="demo">This is a demonstration.</p>

    • A.

      #demo.innerHTML = "Hello World!";

    • B.

      Document.getElementByName("p").innerHTML = "Hello World!";

    • C.

      Document.getElementById("demo").innerHTML = "Hello World!";

    • D.

      Document.getElement("p").innerHTML = "Hello World!";

    Correct Answer
    A. #demo.innerHTML = "Hello World!";
    Explanation
    The correct JavaScript syntax to change the content of the HTML element with the id "demo" is document.getElementById("demo").innerHTML = "Hello World!";. This code uses the getElementById method to select the element with the id "demo" and then changes its innerHTML property to "Hello World!".

    Rate this question:

  • 24. 

    What is the correct syntax for referring to an external script called "xxx.js"?

    • A.

      <script src="xxx.js">

    • B.

      <script name="xxx.js">

    • C.

      <script href="xxx.js">

    • D.

      All Wrong

    Correct Answer
    A. <script src="xxx.js">
    Explanation
    The correct syntax for referring to an external script called "xxx.js" is .

    Rate this question:

  • 25. 

    How do you create a function in JavaScript?

    • A.

      Function = myFunction()

    • B.

      Function:myFunction()

    • C.

      Function myFunction()

    • D.

      All Wrong

    Correct Answer
    C. Function myFunction()
    Explanation
    To create a function in JavaScript, you use the syntax "function myFunction()". This declares a function named "myFunction" that can be called later in the code. The correct answer states this syntax correctly. The other options either have incorrect syntax or are incomplete, making them wrong answers.

    Rate this question:

  • 26. 

    JavaScript is the same as Java.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    JavaScript is not the same as Java. While both languages have similar syntax, they are distinct and serve different purposes. Java is a general-purpose programming language, often used for building large-scale applications, while JavaScript is a scripting language primarily used for web development. The two languages also have different runtime environments, with Java running on a virtual machine and JavaScript running in a web browser. Therefore, the statement that JavaScript is the same as Java is false.

    Rate this question:

  • 27. 

    How to insert a comment that has more than one line?

    • A.

      /*This comment has more than one line*/

    • B.

      //This comment has more than one line//

    • C.

      <!--This comment has more than one line-->

    • D.

      All Options are wrong

    Correct Answer
    A. /*This comment has more than one line*/
    Explanation
    The correct answer is /*This comment has more than one line*/ because in programming languages like C, C++, and Java, multi-line comments are denoted by /* and */. This syntax allows for comments that span multiple lines, making it useful for providing detailed explanations or disabling blocks of code temporarily. The other options provided (// and ) are used for single-line comments or comments in HTML, but they do not support multiple lines.

    Rate this question:

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.