Skip to main content

Fundamentals of Front End Development MCQs with Answers

Practice important Fundamentals of Front End Development MCQs with answers and explanations.

Chapter: 57
Q661:
What does the following code do: function add(a, b) { return a + b; }?
A. Defines a function to multiply a and b
B. Defines a function to add a and b
C. Defines a function to subtract a from b
D. Defines a function to divide a by b
Correct Answer: B
Chapter: 57
Q662:
Fill in the blank: Function parameters are the names listed in the function ____.
A. call
B. invocation
C. definition
D. execution
Correct Answer: C
Chapter: 57
Q663:
How can you access the result of a function in JavaScript?
A. By referencing the function name without ()
B. By calling the function with ()
C. By accessing the function definition
D. By invoking the function with ()
Correct Answer: B
Chapter: 57
Q664:
What is the purpose of the return statement in a JavaScript function?
A. To define the function
B. To call another function
C. To stop the function and return a value
D. To declare function parameters
Correct Answer: C
Chapter: 57
Q665:
Which code snippet correctly defines a function to convert Fahrenheit to Celsius?
A. function toCelsius(f) { return (5/9) * (f - 32); }
B. function toCelsius(fahrenheit) { return 5/9 * f - 32; }
C. function toCelsius(fahrenheit) { return (5/9) * fahrenheit; }
D. function toCelsius(fahrenheit) { return (fahrenheit - 32) / 9 * 5; }
Correct Answer: A
Chapter: 57
Q666:
Fill in the blank: Using toCelsius without parentheses will return the ____.
A. function result
B. function definition
C. function call
D. function parameters
Correct Answer: B
Chapter: 57
Q667:
What is the result of var text = "The temperature is " + toCelsius(32) + " Centigrade"; if toCelsius(32) returns 0?
A. "The temperature is 0 Centigrade"
B. "The temperature is toCelsius(32) Centigrade"
C. "The temperature is " + 0 + " Centigrade"
D. "The temperature is Centigrade"
Correct Answer: A
Chapter: 57
Q668:
Fill in the blank: You can reuse code in JavaScript by defining it once in a ____.
A. variable
B. function
C. comment
D. class
Correct Answer: B
Chapter: 57
Q669:
What will document.getElementById("demo").innerHTML = toCelsius; display if toCelsius is a function?
A. The result of toCelsius function
B. The function definition
C. An error
D. The function name
Correct Answer: B
Chapter: 57
Q670:
Fill in the blank: To define a JavaScript function that accepts parameters, you must include ____ inside the parentheses.
A. data
B. a keyword
C. arguments
D. return values
Correct Answer: C
Chapter: 57
Q671:
What is the result of var text = "The temperature is " + toCelsius(100) + " Centigrade"; if toCelsius(100) returns 37.78?
A. "The temperature is 100 Centigrade"
B. "The temperature is toCelsius(100) Centigrade"
C. "The temperature is 37.78 Centigrade"
D. "The temperature is Centigrade"
Correct Answer: C
Chapter: 58
Q672:
What can be contained in a JavaScript object property?
A. Only numbers
B. Only strings
C. Primitive values, other objects, and functions
D. Only functions
Correct Answer: C
Chapter: 58
Q673:
What is an object method in JavaScript?
A. A function declared outside an object
B. A variable inside an object
C. An object property containing a function definition
D. An object property that is a string
Correct Answer: C
Chapter: 58
Q674:
Fill in the blank: JavaScript objects can contain properties that are ____.
A. only numbers
B. strings
C. primitive values, other objects, and functions
D. only functions
Correct Answer: C
Chapter: 58
Q675:
What is a JavaScript object?
A. A function
B. A container for named values
C. A type of variable
D. A type of loop
Correct Answer: B
Chapter: 58
Q676:
Fill in the blank: In JavaScript, properties of objects can also be _____.
A. numbers only
B. other objects and functions
C. strings only
D. loops
Correct Answer: B
Chapter: 58
Q677:
Which of the following is an example of an object method in JavaScript?
A. var x = 5;
B. function myFunc() { }
C. object.method = function() { }
D. var obj = { property: value };
Correct Answer: C
Chapter: 58
Q678:
What does an object method contain in JavaScript?
A. A string
B. A number
C. A function definition
D. A loop
Correct Answer: C
Chapter: 58
Q679:
Fill in the blank: JavaScript objects are used to store ____.
A. numbers only
B. strings and numbers
C. named values called properties and methods
D. only functions
Correct Answer: C
Chapter: 58
Q680:
What can be a value of a property in a JavaScript object?
A. Only a string
B. Only a number
C. A string, number, object, or function
D. Only a function
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Fundamentals of Front End Development

🚀 Start Quiz Now