Showing 431–440 of 654 questions
Which data structure uses LIFO (Last In First Out) principle?
A
Queue
B
Stack
C
Array
D
Linked List
Explanation:
Stack follows LIFO principle where the last element added is the first to be removed
What is the main purpose of a constructor in a class?
A
To delete objects
B
To initialize objects
C
To perform calculations
D
To print data
Correct Answer:
B. To initialize objects
Explanation:
A constructor is used to initialize objects of a class with default or specified values
In Java, which keyword is used to prevent inheritance?
A
private
B
protected
C
final
D
static
Explanation:
The 'final' keyword prevents a class from being subclassed or inherited
What is the main difference between ArrayList and LinkedList in Java?
A
ArrayList is faster for random access
B
LinkedList is faster for random access
C
Both have same performance
D
ArrayList uses more memory
Correct Answer:
A. ArrayList is faster for random access
Explanation:
ArrayList provides O(1) random access, while LinkedList provides O(n) access
What does 'HTTP' stand for?
A
HyperText Transfer Protocol
B
High Transfer Text Protocol
C
Hyper Transfer Type Protocol
D
Hyper Text Type Protocol
Correct Answer:
A. HyperText Transfer Protocol
Explanation:
HTTP stands for HyperText Transfer Protocol, the foundation of data communication on the web
Which of these is a NoSQL database?
A
MySQL
B
PostgreSQL
C
MongoDB
D
Oracle
Correct Answer:
C. MongoDB
Explanation:
MongoDB is a NoSQL database. MySQL, PostgreSQL, and Oracle are relational SQL databases
In CSS, what does the 'z-index' property control?
A
Font size
B
Text alignment
C
Stacking order of elements
D
Background color
Correct Answer:
C. Stacking order of elements
Explanation:
z-index controls the stacking order of overlapping elements on a webpage
What will be the output of: console.log(typeof 5) in JavaScript?
A
int
B
number
C
integer
D
numeric
Correct Answer:
B. number
Explanation:
The typeof operator returns 'number' for numeric values in JavaScript
A rope of length 30 meters is cut into 5 equal parts. How long is each piece?
A
5 meters
B
6 meters
C
7 meters
D
8 meters
Correct Answer:
B. 6 meters
Explanation:
30 meters / 5 = 6 meters per piece
If 30% of a number is 45, what is the number?
Explanation:
Let number = x. 30% of x = 45. 0.30x = 45. x = 45/0.30 = 150