Fundamentals of Front End Development MCQs with Answers
Practice important Fundamentals of Front End Development MCQs with answers and explanations.
Chapter: 89
Q1001:
Fill in the blank: To cancel a timer set with setTimeout(), you use the _____.
A. setInterval() method
B. clearInterval() method
C. clearTimeout() method
D. window.open() method
Correct Answer:
C
Chapter: 89
Q1002:
Which method is used to call a function repeatedly at specified intervals?
A. setTimeout()
B. clearTimeout()
C. setInterval()
D. clearInterval()
Correct Answer:
C
Chapter: 89
Q1003:
Fill in the blank: The method used to execute a function after a delay of 3000 milliseconds is _____.
A. setInterval()
B. clearTimeout()
C. setTimeout()
D. window.close()
Correct Answer:
C
Chapter: 90
Q1004:
How can you access a form field value in JavaScript using the DOM?
A. document.getElementById("myForm").fieldname.value
B. document.forms["myForm"]["fieldname"].value
C. document.querySelector("fieldname").value
D. document.getElementById("fieldname").value
Correct Answer:
B
Chapter: 90
Q1005:
Fill in the blank: To prevent a form from being submitted if a field is empty, you can use the ______ method.
A. validateForm()
B. checkForm()
C. submitForm()
D. processForm()
Correct Answer:
A
Chapter: 90
Q1006:
What does the required attribute do in HTML form validation?
A. Ensures the form field is optional
B. Prevents the form from being submitted if the field is empty
C. Allows the field to be submitted without validation
D. Automatically fills the field with default values
Correct Answer:
B
Chapter: 90
Q1007:
What does the validateForm() function check in the provided example?
A. If the form field is filled with a number
B. If the form field contains a valid email address
C. If the form field is empty
D. If the form field value matches a specific pattern
Correct Answer:
C
Chapter: 90
Q1008:
Fill in the blank: To access a form using its ID in JavaScript, you can use ______.
A. document.getElementById("formID")
B. document.querySelector("#formID")
C. document.forms["formID"]
D. document.getElementById("formID").elements
Correct Answer:
A
Chapter: 90
Q1009:
What method is used to prevent a form from being submitted if a field is empty?
A. return false;
B. alert("Message");
C. document.write();
D. window.open();
Correct Answer:
A
Chapter: 90
Q1010:
Fill in the blank: In the example provided, the form is validated by calling ______ when the form is submitted.
A. validateForm()
B. checkForm()
C. submitForm()
D. processForm()
Correct Answer:
A
Chapter: 90
Q1011:
How do you specify a form action in HTML?
A. action="URL"
B. method="URL"
C. formaction="URL"
D. submit="URL"
Correct Answer:
A
Chapter: 90
Q1012:
What is the primary purpose of data validation in forms?
A. To ensure input is clean, correct, and useful
B. To format the input in a specific way
C. To automatically fill out fields
D. To generate dynamic form elements
Correct Answer:
A
Chapter: 90
Q1013:
Fill in the blank: The onsubmit attribute in an HTML form is used to ______.
A. Validate the form before submission
B. Change the form action
C. Hide the form fields
D. Submit the form immediately
Correct Answer:
A
Chapter: 91
Q1014:
What does AJAX stand for?
A. Asynchronous JavaScript and XML
B. Asynchronous JavaScript and XSLT
C. Asynchronous Java and XML
D. Asynchronous JavaScript and XHTML
Correct Answer:
A
Chapter: 91
Q1015:
Which object is used to retrieve data from a web server in AJAX?
A. XMLHttpRequest
B. JavaScript
C. DOM
D. fetch
Correct Answer:
A
Chapter: 91
Q1016:
Fill in the blank: AJAX allows web pages to be updated ______ by exchanging small amounts of data with the server.
A. synchronously
B. asynchronously
C. in real-time
D. manually
Correct Answer:
B
Chapter: 91
Q1017:
Which of the following is NOT a real-life example of AJAX usage?
A. Gmail
B. Facebook
C. Youtube
D. Notepad
Correct Answer:
D
Chapter: 91
Q1018:
What combination of technologies does AJAX use?
A. XMLHttpRequest and CSS
B. XMLHttpRequest and HTML
C. XMLHttpRequest and JavaScript/DOM
D. XMLHttpRequest and Java
Correct Answer:
C
Chapter: 91
Q1019:
Fill in the blank: With AJAX, web applications like ______ can update their content without reloading the entire page.
A. Notepad
B. Google Maps
C. Text Editor
D. Command Prompt
Correct Answer:
B
Chapter: 91
Q1020:
Which technology is used by AJAX to display or use the data received from the server?
A. XMLHttpRequest
B. HTML
C. JavaScript/DOM
D. SQL
Correct Answer:
C