Skip to main content

Web Design and Development MCQs with Answers

Practice important Web Design and Development MCQs with answers and explanations.

Chapter: 5
Q81:
What does the super keyword do in Java?
A. Refers to the current instance
B. Calls methods from the current class
C. Refers to the superclass and calls its methods
D. Creates new instance of superclass
Correct Answer: C
Chapter: 6
Q82:
In Java garbage collection is done by_______________
A. JVM (Java Virtual Machine)
B. Programmer
C. Both JVM (Java Virtual Machine)and Programmer
D. OS (Operating System)
Correct Answer: A
Chapter: 6
Q83:
How is an overridden method different from an overloaded method in Java?
A. Overridden methods have the same name and parameters as in the superclass
B. Overloaded methods have the same name but different parameters
C. Overridden methods have different names from superclass methods
D. Overloaded methods are defined in the same class only
Correct Answer: A
Chapter: 6
Q84:
How do you create a new instance of a class in Java?
A. Using new keyword
B. Using create keyword
C. Using instance keyword
D. Using class keyword
Correct Answer: A
Chapter: 6
Q85:
What is a key feature of Java Collections?
A. Fixed size
B. Dynamic size
C. Limited types
D. None of the above
Correct Answer: B
Chapter: 6
Q86:
Which class in Java is a replacement for Vector?
A. LinkedList
B. HashMap
C. ArrayList
D. TreeSet
Correct Answer: C
Chapter: 6
Q87:
What method is used to add an element to an ArrayList?
A. insert()
B. append()
C. add()
D. push()
Correct Answer: C
Chapter: 6
Q88:
What does the size() method of a collection return?
A. The first element
B. The last element
C. The number of elements
D. The maximum capacity
Correct Answer: C
Chapter: 6
Q89:
How do you retrieve an element at a specific index from an ArrayList?
A. get()
B. fetch()
C. retrieve()
D. access()
Correct Answer: A
Chapter: 6
Q90:
What is the purpose of the contains(Object o) method in Java collections?
A. To remove an object
B. To check if an object is present
C. To add an object
D. To replace an object
Correct Answer: B
Chapter: 6
Q91:
Which method removes an element at a specified index in an ArrayList?
A. delete()
B. remove()
C. erase()
D. discard()
Correct Answer: B
Chapter: 6
Q92:
How are elements stored in a HashMap?
A. In a list
B. In a set
C. As key-value pairs
D. In a queue
Correct Answer: C
Chapter: 6
Q93:
What does the put(Object key, Object value) method do in a HashMap?
A. Retrieves the value for a given key
B. Replaces the value for a given key
C. Deletes a key-value pair
D. Adds a key-value pair
Correct Answer: D
Chapter: 6
Q94:
Which method of HashMap returns the value associated with a given key?
A. get()
B. find()
C. fetch()
D. search()
Correct Answer: A
Chapter: 6
Q95:
How do you check if a HashMap is empty?
A. isEmpty()
B. checkEmpty()
C. hasNoElements()
D. empty()
Correct Answer: A
Chapter: 6
Q96:
In Java, what does up-casting involve?
A. Converting a larger data type to a smaller one
B. Converting a smaller data type to a larger one
C. Implicit casting
D. Explicit casting
Correct Answer: B
Chapter: 6
Q97:
What type of casting is required when converting a larger data type to a smaller one?
A. Up-casting
B. Down-casting
C. Implicit casting
D. Automatic casting
Correct Answer: B
Chapter: 6
Q98:
Which class provides the capability to store key-value pairs in Java?
A. ArrayList
B. HashSet
C. HashMap
D. LinkedList
Correct Answer: C
Chapter: 6
Q99:
What is the main purpose of the remove(Object o) method in a collection?
A. To add an object
B. To check if an object is present
C. To remove a specific object
D. To replace an object
Correct Answer: C
Chapter: 6
Q100:
How do you iterate over elements in an ArrayList?
A. Using a for-each loop
B. Using a while loop
C. Using a do-while loop
D. Using a for loop
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Web Design and Development

🚀 Start Quiz Now