JavaScript Operators and Functions Quiz
17 Questions
5 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What are the different types of operators supported in JavaScript?

  • Arithmetic, Relational, Logical (correct)
  • Addition, Subtraction, Multiplication
  • Comparison, Assignment, Increment
  • Multiplication, Division, Exponentiation
  • Which function is used to convert a string to an integer in JavaScript?

  • parseInteger() (correct)
  • convertToInt()
  • toInt()
  • parseFloat()
  • What are the control statements in JavaScript?

  • break, continue
  • for loop, while loop
  • switch, case
  • if, if...else (correct)
  • Which tag is used to display a horizontal ruled line in HTML?

    Signup and view all the answers

    What will be the output of the following code snippet? Enter your age: if(age > 18) { console.log('Allowed to drive'); } else { console.log('Not allowed to drive'); }

    <p>Undefined</p> Signup and view all the answers

    Identify the logical operators used in JavaScript.

    <p>||, &amp;&amp;</p> Signup and view all the answers

    In JavaScript, what will be the result of this expression? $5 imes 8 + 2$

    <p>$42$</p> Signup and view all the answers

    Which of the following HTML5 tags is used for marking up sidebars or content that is tangentially related to the main content?

    Signup and view all the answers

    What does the '||' operator represent in JavaScript?

    <p>Logical OR</p> Signup and view all the answers

    If a variable in JavaScript is declared but not assigned a value, what is its default value?

    <p>undefined</p> Signup and view all the answers

    What is the purpose of the 'toUpperCase()' function in JavaScript?

    <p>Converts a string to uppercase</p> Signup and view all the answers

    Which data type in JavaScript represents only two values, 'true' and 'false'?

    <p>Boolean</p> Signup and view all the answers

    What value does JavaScript return when you perform the division operation 3/0?

    <p>Infinity</p> Signup and view all the answers

    What does 'null' represent in JavaScript?

    <p>A special value for nothing or empty</p> Signup and view all the answers

    What happens when a variable is declared but not assigned any value in JavaScript?

    <p>'undefined' is returned</p> Signup and view all the answers

    When does JavaScript return 'undefined' for a variable?

    <p>When the variable is declared but not initialized</p> Signup and view all the answers

    Which value is returned when an arithmetic operation results in dividing a number by 0?

    <p>+Infinity</p> Signup and view all the answers

    Study Notes

    JavaScript Basics

    • JavaScript supports different data types: number, string, boolean, infinity, null, and undefined
    • Number data type stores both whole numbers (integer) and decimal point numbers (floating point numbers)
    • String data type stores text and must be inside double or single quotes
    • Boolean data type represents only two values: true and false
    • Infinity is a special value obtained by dividing a number by 0
    • Null is a value that means "nothing", "empty", or "unknown"
    • Undefined is returned when a variable is declared but not assigned a value

    Variable Declaration

    • Variables can be declared using the var keyword
    • Multiple variables can be declared in a single statement, separated by commas
    • Variables can be declared with initialization

    Operators

    • JavaScript supports various operators, including:
      • Arithmetic operators: +, -, *, /, %
      • Relational operators: ==, !=, >, <, >=, <=
      • Logical operators: &&, ||, !
      • Conditional operators: if, if...else

    Control Statements

    • JavaScript supports control statements, including:
      • if statements
      • if...else statements

    Functions

    • JavaScript supports built-in functions, such as:
      • parseInt()
      • parseFloat()
      • prompt()
      • confirm()
      • alert()
    • JavaScript also supports user-defined functions

    HTML5

    • HTML5 includes new semantic tags, such as:
      • ``
      • ``
      • ``
      • ``
      • ``
    • HTML5 is suitable for creating modern web applications with semantic meaning

    Exercises

    • Answer the following questions:
      • What is the data entry operator used for?
      • What are physical tags?
      • What are paired tags and empty tags?
      • Identify the logical operators in JavaScript
    • Complete the program to display the multiplication of 6.40 and 300
    • State at least three attributes of a series
    • Find the error in the given JavaScript code

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge of JavaScript operators and functions with this quiz. Questions cover topics like logical operators, assignment operators, and function declarations.

    More Like This

    JavaScript Operators Quiz
    5 questions
    JavaScript Advanced Operators
    13 questions
    Use Quizgecko on...
    Browser
    Browser