3.4 JavaScript

9 Computer Science · Chapter 3: Programming Fundamentals · Federal Board (FBISE)

3.4 JavaScript from Federal Board 9 Computer Science (9th Class) Chapter 3, Programming Fundamentals: 9 short and long questions and 69 MCQs with answers.

JavaScript MCQs

15 of 69
  1. Q1

    JavaScript is embedded in HTML using which tag?

    1. A<style>
    2. B<script>
    3. C<js>
    4. D<code>
    Show answer

    Correct answer: B. <script>

    JavaScript goes inside the <script> tag.

  2. Q2

    Which function displays a string on a webpage?

    1. Aprompt()
    2. Balert()
    3. Cdocument.write()
    4. Dinput()
    Show answer

    Correct answer: C. document.write()

    document.write() prints text on the page.

  3. Q3

    An action sensed by a program that triggers a task is called a(n):

    1. AVariable
    2. BFunction
    3. CEvent
    4. DLoop
    Show answer

    Correct answer: C. Event

    Such a triggered action is an event.

  4. Q4

    Which symbol is used for a single-line comment?

    1. A#
    2. B//
    3. C<!-- -->
    4. D**
    Show answer

    Correct answer: B. //

    JavaScript uses // for single-line comments.

  5. Q5

    Which function pops up a window to take user input?

    1. Aalert()
    2. Bwrite()
    3. Cprompt()
    4. Devent()
    Show answer

    Correct answer: C. prompt()

    prompt() takes input from the user.

  6. Q6

    Which function informs the user about the result of an action?

    1. Aprompt
    2. Balert
    3. Cloop
    4. Darray
    Show answer

    Correct answer: B. alert

    alert displays a message to the user.

  7. Q7

    An entity that stores a value for later use is a:

    1. AFunction
    2. BVariable
    3. CLoop
    4. DTag
    Show answer

    Correct answer: B. Variable

    A variable stores a value for later use.

  8. Q8

    Which keyword declares a variable?

    1. Aint
    2. Bdim
    3. Cvar
    4. Ddefine
    Show answer

    Correct answer: C. var

    The var keyword declares a variable.

  9. Q9

    Which is a basic data type in JavaScript?

    1. AArray
    2. BBoolean
    3. CTable
    4. DNode
    Show answer

    Correct answer: B. Boolean

    Number, String and Boolean are basic data types.

  10. Q10

    The first assignment of a value to a variable is called:

    1. ADeclaration
    2. BInitialization
    3. CDeletion
    4. DExecution
    Show answer

    Correct answer: B. Initialization

    The first value assignment is initialization.

  11. Q11

    Which character can begin a variable name?

    1. A7
    2. B@
    3. CA
    4. D1
    Show answer

    Correct answer: C. A

    Names cannot start with a number; a letter is valid.

  12. Q12

    Using a variable before declaring and giving it a value shows:

    1. A0
    2. BError
    3. Cundefined
    4. Dblank
    Show answer

    Correct answer: C. undefined

    It displays 'undefined'.

  13. Q13

    A variable name cannot start with a:

    1. ALetter
    2. BUnderscore (_)
    3. CDollar sign ($)
    4. DNumber
    Show answer

    Correct answer: D. Number

    A variable name can never start with a number

  14. Q14

    Which operator gives the remainder of a division?

    1. A/
    2. B*
    3. C%
    4. D+
    Show answer

    Correct answer: C. %

    The modulus (%) gives the remainder.

  15. Q15

    For reward = 5555, reward % 10 equals:

    1. A5
    2. B555.5
    3. C55
    4. D0
    Show answer

    Correct answer: A. 5

    5555 divided by 10 leaves remainder 5.

JavaScript short questions

  1. What are JavaScript variables? Give an example.

    Important
  2. What are JavaScript Operators? Also give their types.

    Important
  3. What are JavaScript Conditional Statements?

    Important
  4. What are loops in JavaScript?

    Important
  5. How do you define and call a function in JavaScript?

    Important
  6. What is an array in JavaScript? Give an example.

    Important
  7. What is the difference between local and global variables in a function?

JavaScript long questions

  1. Explain loops and nested loops in JavaScript with examples. Also define a function.

    Important
  2. Explain variables, operators and conditional statements in JavaScript with examples.

Chapter 3 study material

A little trouble connecting

We could not reach IlmiDunya. Your connection may be slow or interrupted. Check your connection and try again.

If you were saving or submitting, check the result before trying again.

Account blocked

You are blocked from using IlmiDunya. Contact support to unblock your account.