Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Chapter: 38
Q761:
What does the continue statement do in JavaScript loops?
A. Exits the loop
B. Skips the rest of the current iteration
C. Repeats the current iteration
D. Stops all script execution
Correct Answer:
B
Chapter: 38
Q762:
In JavaScript, the result of var x = "2" + "2"; is:
A. 4
B. "22"
C. Error
D. Null
Correct Answer:
B
Chapter: 38
Q763:
JavaScript arrays are susceptible to:
A. Aliasing
B. Overloading
C. Overriding
D. Error-prone initialization
Correct Answer:
A
Chapter: 38
Q764:
Which attribute is recommended by W3C for specifying JavaScript type?
A. language
B. type
C. script
D. src
Correct Answer:
B
Chapter: 38
Q765:
What does the === operator compare in JavaScript?
A. Values only
B. Types only
C. Values and types
D. Arrays
Correct Answer:
C
Chapter: 38
Q766:
What will the following statement output? document.write("JavaScript" + "is" + "great!");
A. JavaScriptisgreat!
B. JavaScript is great!
C. JavaScript_is_great!
D. JavaScript-is-great!
Correct Answer:
B
Chapter: 39
Q767:
What does an object in JavaScript represent?
A. A collection of strings
B. A collection of data types and functions
C. A single number
D. Only functions
Correct Answer:
B
Chapter: 39
Q768:
In JavaScript, which object model provides access to browser characteristics?
A. Document Object Model (DOM)
B. Browser Object Model (BOM)
C. Global Object Model (GOM)
D. Window Object Model (WOM)
Correct Answer:
B
Chapter: 39
Q769:
The method to access properties of an object in JavaScript is:
A. using curly brackets
B. using dot notation
C. using square brackets
D. using colons
Correct Answer:
B
Chapter: 39
Q770:
The Document Object Model (DOM) in JavaScript is used to:
A. Access browser history
B. Access HTML content
C. Access operating system
D. Access browser settings
Correct Answer:
B
Chapter: 39
Q771:
Objects in JavaScript can contain both ____ and _____.
A. Strings and arrays
B. Properties and methods
C. Numbers and Booleans
D. Functions and variables
Correct Answer:
B
Chapter: 39
Q772:
Fill in the blank: In JavaScript, the ______ provides access to HTML elements within a webpage.
A. Browser Object Model (BOM)
B. Document Object Model (DOM)
C. Built-in Object Model
D. User-defined Object Model
Correct Answer:
B
Chapter: 39
Q773:
Which object in JavaScript can access browser window characteristics?
A. Navigator Object
B. Browser Object Model (BOM)
C. Document Object Model (DOM)
D. Window Object
Correct Answer:
B
Chapter: 39
Q774:
What is the correct syntax for the write method of the document object?
A. document.write("text")
B. doc.write("text")
C. documentWrite("text")
D. docWrite("text")
Correct Answer:
A
Chapter: 39
Q775:
In JavaScript, a variable of type object may have its properties accessed using:
A. Object notation
B. Dot notation
C. Property brackets
D. Function calls
Correct Answer:
B
Chapter: 39
Q776:
Which object provides access to browser history in JavaScript?
A. Navigator Object
B. History Object
C. Window Object
D. DOM Object
Correct Answer:
B
Chapter: 39
Q777:
What is the purpose of the "with" statement in JavaScript?
A. Declare a new variable
B. Simplify repetitive code with an object
C. Close open objects
D. Call a function
Correct Answer:
B
Chapter: 39
Q778:
Fill in the blank: An ordered set of values grouped under a single identifier in JavaScript is called a/an ______.
A. Object
B. Array
C. Method
D. Class
Correct Answer:
B
Chapter: 39
Q779:
In the code document.write("Hello World");, the write method is part of which object?
A. Window Object
B. Document Object
C. Navigator Object
D. Browser Object
Correct Answer:
B
Chapter: 40
Q780:
What is a reserved word in programming languages?
A. A word used for comments
B. A word special only in certain contexts
C. A word not allowed as a user-defined name
D. A variable used in loops
Correct Answer:
C