About JavaScript

Following are some of the multiple choice questions on the JavaScript with answers that will help the students in developing their knowledge.

JavaScript MCQ

1. Used to write comments

  • ++
  • =
  • //
  • --

2. Read the code below:alert(!false);What would the output be?

  • True
  • False

3. What is the IP address of www.cisco.com

  • 192.168.1.2
  • 172.16.31.1
  • 10.0.0.1
  • 104.82.199.178

4. A boolean;

  • Expresses a true false statement
  • can contain letters, numbers, spaces, and symbols.
  • takes in an input, does something with it, and then returns an output.
  • Runs a boolean (true/false) statement based on data entered

5. A function;

  • Expresses a true false statement
  • can contain letters, numbers, spaces, and symbols.
  • takes in an input, does something with it, and then returns an output.
  • Runs a boolean (true/false) statement based on data entered

6. An if/else statement;

  • Expresses a true false statement
  • can contain letters, numbers, spaces, and symbols.
  • takes in an input, does something with it, and then returns an output.
  • Runs a boolean (true/false) statement based on data entered

7. Which of these is a loop?

  • if(x<10)
  • while(x<10)
  • var x=10;
  • text(x,10;10)

8. Greater than or equal to

  • > or =
  • > || =
  • >=
  • <=

9. Repeat something 10 times

  • repeat 10
  • for (var i=0; i<10; i++)
  • repeat { } until 10;
  • while (i = 10)

10. When we are done with a line what do we put at the end?

  • a colon :
  • a semi-colon ;
  • a period .
  • a quotation mark "

11. When we surround a word with quotes "David" it's called ?

  • a program
  • a loop
  • a string
  • a command

12. In a programming language, __________ are used to store data values.

  • tags
  • codes
  • files
  • variables

13. A network limited to a room or building.

  • LAN
  • MAN
  • WAN
  • CAN

14. The simplest data-storing structure in any programming language

  • Lists
  • Array
  • Queue
  • List

15. These are any variable names listed within a function's argument definition.example: myFunction(x, y)

  • Parameter
  • Literals
  • Constraints
  • Variables

16. Which of the following is NOT a valid starting character for JS variable names?

  • Uppercase Letter
  • Lowercase Letter
  • Dollar Sign
  • Underscore

17. This allows JS Scripts and applications to perform different actions based on given conditions.

  • Variables
  • Loops
  • Conditional Statement
  • Stacks

18. Which of the following is NOT a valid component of a function declaration?

  • Function keyword
  • Function name
  • Pair of Square Braces
  • Pair of Curly Braces

19. Which of the following is a symbol that must NOT be present in any JS Variable?

  • A
  • z
  • _
  • %

20. A property that contains a function definition.

  • Object Properties
  • Object Attributes
  • Object Methods
  • Objects

21. Method used to select the element with a given identifier represented by the HTML element property ID

  • getElementByClassName() method
  • getElementById() method
  • getId()
  • getElementByTagName()

22. Which of the following operator is used for the Assignment Operator?

  • ==
  • !
  • =
  • +

23. Which of the Tag Pair is used to enable JS script writing in HTML?

  • <br>
  • <script>
  • <JS>
  • <code>

24. What is the symbol pair used to write a new line within a string values?

  • \*
  • \'
  • \n
  • \br

25. In JS, Arrays are considered as what type of programming concept?

  • Class
  • Variable
  • Object
  • Function

26. What is the symbol used for the INCREMENT operator in JS?

  • +
  • ++
  • =
  • ==

27. Using object constructors what specific keyword is used to create new object?

  • if
  • var
  • new
  • this

28. Which funtion is used when a JS application must ensure that the user gets the information that is displayed?

  • Alert box
  • Prompt Box
  • Combo Box
  • Confirm Box

29. Which of the following is NOT a valid keyword for JS

  • new
  • switch
  • synchronize
  • void

30. Conditions return values of which data type?

  • Integer
  • boolean
  • floating-point
  • string

31. File extension for external JS files

  • .javascript
  • .js
  • .jscript
  • .script

32. Built in object in JS that allows a script to perform mathematical task

  • Arithmetic
  • Math Object
  • Operation Object
  • Mathematics Object

33. What command draws a perfect circle?

  • ellipse (80, 60, 100, 105);
  • ellipse(80, 60, 100, 100);
  • circle (80, 60, 80, 60):
  • ellipse (80, 60, 105, 100);

34. What surrounds an if/else statement?

  • Quotations
  • Curly Brackets
  • Parenthesis
  • Square Brackets

35. A variable;

  • Expresses a true false statement
  • stores a string, number, or boolean, and gives it a specific, case-sensitive name
  • takes in an input, does something with it, and then returns an output.
  • Runs a boolean (true/false) statement based on data entered

36. A short form writing the word variable is

  • rav
  • VAR
  • var
  • varia

37. His name is Fred and he is less than 16 years old

  • if (name = "fred" && age < 16 )
  • if (name === "fred" && age < 16 )
  • if (name = "fred" || age < 16 )
  • if (name === "fred" || age < 16 )

38. Which of the following will decrease the value of x?

  • x--;
  • x-1;
  • x=x;
  • x=-x;

39. Which command provides a random color?

  • Randomizer.color
  • Randomizer.nextColor()
  • RandColor;
  • nextColor.Randomizer()

40. This saves a value, which can be then assigned when writing code

  • Parameter
  • Function
  • Variable

41. JavaScript uses the _______ keyword to define variables.

  • vrb
  • var
  • vari
  • va

42. A variable is used to:

  • Store a value in memory
  • Draw a circle
  • Store a value that does not change
  • Draw a rectangle

43. The following code will: x++;

  • Add 1 to the previous value of x
  • Add 1 to the previous value of y
  • Subtract 1 from the previous value of x
  • Give an error message

44. Any code that is within the following draw function:draw = function(){......}

  • Will be performed twice
  • Will not be performed
  • Will be performed once
  • Will be repeated over and over again

45. What does the "fill" command do

  • put letters in the shape
  • put pictures in the shape
  • put color in the shape
  • put code in the shape

46. The "stroke" command means

  • color inside shape
  • color outside shape
  • color of blocks
  • border

47. What command draws a line?

  • stroke (200, 220, 275, 220);
  • line (200, 220, 275, 220);
  • horizontal (200, 220,  60, 75);
  • pencil (200, 220, 275, 220);

48. What command colors a shape?

  • color (43, 255, 0);
  • bucket (43, 255, 0);
  • fill (43, 255, 0);
  • bucket (43, 255, 0);

49. JavaScript is an ________ language.

  • compiled
  • interpreted

50. JavaScript is can be written -

  • directly into JS file and included into HTML
  • directly into HTML pages
  • directly on the Server Script
  • None of these

Enjoyed the Quiz. Share this with friends

Comments

Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.