0% found this document useful (0 votes)
8 views103 pages

MCQ Placement

Uploaded by

AMAN AGARWAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views103 pages

MCQ Placement

Uploaded by

AMAN AGARWAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 103

100 Practice MCQs

1. What is the time complexity of inserting an element into a hash table (average case)?
a) O(1)
b) O(log n)
c) O(n)
d) O(n log n)

Explanation:

• A hash table stores data using a hash function that maps keys to indices in an array.

• When inserting, the key is hashed, and the element is stored at the resulting index.

• Average case: assuming a good hash function and low load factor, insertion happens in
constant time O(1).

• Worst case: all keys collide into the same bucket (rare), time becomes O(n).

• Key idea: hash tables are fast for insert, delete, and search operations due to direct
indexing.

2. Which data structure uses FIFO (First In First Out)?


a) Stack
b) Queue
c) Tree
d) Graph

Explanation:

• FIFO (First In, First Out) means the element that enters first is removed first.

• A queue is designed exactly for this behavior:

◦ Enqueue: add element at the rear.

◦ Dequeue: remove element from the front.

• Stack uses LIFO (Last In First Out).

• Trees and graphs are general structures and don’t inherently follow FIFO or LIFO.

3. Which sorting algorithm is stable?


a) Quick Sort
b) Heap Sort
c) Merge Sort
d) Selection Sort
Explanation:

• A stable sort preserves the relative order of records with equal keys.

• Merge Sort: stable because when merging, equal elements from left subarray are copied
before right subarray.

• Quick Sort: not stable by default, because partitioning can change relative order.

• Heap Sort: not stable, because heap operations can reorder equal elements.

• Selection Sort: not stable (swaps can reorder equal elements).

• Stability matters when sorting by multiple criteria (e.g., first by age, then by name).

4. What traversal of a binary search tree gives elements in sorted order?


a) Pre-order
b) In-order
c) Post-order
d) Level-order

Explanation:

• Binary Search Tree (BST) property: left child < parent < right child.

• Traversals:

◦ Pre-order (Root → Left → Right): not sorted.

◦ In-order (Left → Root → Right): always produces ascending order.

◦ Post-order (Left → Right → Root): used for deletion/cleanup.

◦ Level-order (BFS): visits level by level, not sorted.

• So, for BST, in-order traversal gives sorted elements.

5. Which of the following is not a pillar of Object-Oriented Programming (OOP)?


a) Encapsulation
b) Polymorphism
c) Compilation
d) Inheritance

Explanation:

• Pillars of OOP:

1. Encapsulation: hiding internal data and exposing methods.


2. Inheritance: deriving new classes from existing ones.

3. Polymorphism: same interface, multiple implementations.

4. Abstraction: hiding complexity, exposing only necessary features.

• Compilation is a process of converting code into machine instructions, not an OOP


concept.

6. The “ == ” operator in Java compares:


a) Object content
b) References (memory addresses)
c) Both a and b
d) None

Answer: b) References (memory addresses)

Explanation:

• In Java, == for objects checks if two references point to the same memory location, not
whether the objects’ content is equal.

• Example:

String a = new String("hello");


String b = new String("hello");
System.out.println(a == b); // false, different objects
System.out.println(a.equals(b)); // true, contents are same
• Use .equals() to compare object content.

• Note: For primitive types (int, boolean, char, etc.), == compares values directly.

7. Which SQL clause is used to remove duplicate rows in the result?


a) REMOVE DUPLICATES
b) UNIQUE
c) DISTINCT
d) NO DUP

Answer: c) DISTINCT

Explanation:

• The DISTINCT keyword in SQL ensures that duplicate rows are removed in query
results.

• Example:
SELECT DISTINCT city FROM customers;
• Returns unique cities only.

• UNIQUE is used as a constraint when creating a table, not in SELECT queries.

8. Which HTTP method is idempotent?


a) GET
b) POST
c) PATCH
d) All of the above

Answer: a) GET

Explanation:

• Idempotent: multiple identical requests have the same effect as a single request.

• GET: safe and idempotent – fetching the same resource repeatedly doesn’t change server
state.

• POST: not idempotent – submitting multiple times may create multiple resources.

• PATCH: not guaranteed idempotent; may partially update resources differently.

9. Which of the following status codes means “Not Found”?


a) 200
b) 301
c) 404
d) 500

Answer: c) 404

Explanation:

• HTTP status codes:

◦ 200 OK: request successful

◦ 301 Moved Permanently: URL redirected

◦ 404 Not Found: resource does not exist

◦ 500 Internal Server Error: server-side error

• 404 is the standard “resource not found” code.


10. Which of these is a NoSQL database?
a) MySQL
b) PostgreSQL
c) MongoDB
d) Oracle

Answer: c) MongoDB

Explanation:

• NoSQL databases are non-relational, schema-less, and often store data as documents, key-
value, or graphs.

• MongoDB: document-oriented, stores JSON-like documents.

• MySQL, PostgreSQL, Oracle: relational databases using tables and SQL queries.

11. Which keyword in SQL is used to group rows having same values in one or more columns?
a) WHERE
b) GROUP BY
c) ORDER BY
d) HAVING

Answer: b) GROUP BY

Explanation:

• GROUP BY is used to aggregate rows with same column values.

• Often used with aggregate functions like COUNT(), SUM(), AVG().

• Example:

SELECT department, COUNT(*)


FROM employees
GROUP BY department;
• WHERE filters rows before grouping.

• HAVING filters groups after aggregation.

• ORDER BY sorts results, doesn’t group them.

12. In Git, what command is used to create a new branch and switch to it in one step?
a) git branch new_branch
b) git checkout new_branch
c) git checkout -b new_branch
d) git init new_branch

Answer: c) git checkout -b new_branch

Explanation:

• git branch new_branch – creates a branch but does not switch to it.

• git checkout new_branch – switches to an existing branch.

• git checkout -b new_branch – creates and switches to the new branch in one
command.

• git init new_branch – initializes a new Git repository; not used for branch creation.

13. What does REST stand for?


a) Representational State Transfer
b) Rapid Stateful Transfer
c) Real-time State Transfer
d) None of the above

Answer: a) Representational State Transfer

Explanation:

• REST is an architectural style for designing web services.

• Key concepts:

◦ Resource-based: Everything is a resource identified by a URL.

◦ Stateless: Each request from client to server must contain all information needed.

◦ HTTP methods: Uses GET, POST, PUT, DELETE for CRUD operations.

• The acronym REST literally means Representational State Transfer, referring to


transferring the state of resources over HTTP.

14. Which algorithm is best for finding shortest path in a graph with non-negative weights?
a) Bellman-Ford
b) Dijkstra
c) Floyd-Warshall
d) Prim’s

Answer: b) Dijkstra

Explanation:
• Dijkstra’s algorithm finds the shortest path from a single source to all vertices in a
weighted graph with non-negative weights efficiently.

• Bellman-Ford: can handle negative weights, slower O(VE) time.

• Floyd-Warshall: all-pairs shortest path, O(V³), overkill for single-source.

• Prim’s: finds minimum spanning tree, not shortest path.

15. What is complexity of binary search?


a) O(n)
b) O(log n)
c) O(n log n)
d) O(n²)

Answer: b) O(log n)

Explanation:

• Binary search works on sorted arrays.

• Each step divides the search space by 2:

◦ Start with the middle element.

◦ If target < middle → search left half.

◦ If target > middle → search right half.

• Time complexity: O(log n) (log base 2), very efficient for large datasets.

• Linear search would be O(n).

16. Which of the following is true about stack & queue?


a) Stack is FIFO, queue is LIFO
b) Both are LIFO
c) Stack is LIFO, queue is FIFO
d) Both are FIFO

Answer: c) Stack is LIFO, queue is FIFO

Explanation:

• Stack: Last In, First Out (LIFO)

◦ Example: plates in a stack.

◦ Push adds to top, pop removes from top.


• Queue: First In, First Out (FIFO)

◦ Example: people in a queue.

◦ Enqueue at rear, dequeue from front.

• Remember: Stack → LIFO, Queue → FIFO.

17. Which of the following is NOT a valid JSON data type?


a) String
b) Number
c) Date
d) Boolean

Answer: c) Date

Explanation:

• Valid JSON types: string, number, boolean, null, array, object.

• JSON does not have a date type. Dates are usually represented as strings in ISO format,
e.g., "2025-09-17T14:00:00Z".

• So Date is not a valid primitive type in JSON.

18. What is the output of “5 / 2” in Python 3?


a) 2
b) 2.5
c) 2.0
d) Error

Answer: b) 2.5

Explanation:

• In Python 3, / performs floating-point division even for integers.

• 5 / 2 → 2.5 (float).

• If you want integer division, use //:

19. Which class of IP address is 192.168.x.x?


a) Class A
b) Class B
c) Class C
d) Class D
Answer: c) Class C

Explanation:

• IP address classes:

◦ Class A: 1.0.0.0 – 126.255.255.255

◦ Class B: 128.0.0.0 – 191.255.255.255

◦ Class C: 192.0.0.0 – 223.255.255.255

◦ Class D: 224.0.0.0 – 239.255.255.255 (multicast)

• 192.168.x.x is in Class C, often used in private networks.

20. What is the function of DNS?


a) Domain Name to IP resolution
b) Encrypting traffic
c) Routing protocol
d) None

Answer: a) Domain Name to IP resolution

Explanation:

• DNS stands for Domain Name System.

• Humans use domain names like www.google.com, but computers communicate via IP
addresses like 142.250.190.68.

• DNS translates domain names into IP addresses so that web browsers and servers can
communicate.

• It is not used for encryption or routing, though DNS queries are involved in networking.

21. What does ACID in database systems stand for?


a) Atomicity, Consistency, Isolation, Durability
b) Atomicity, Concurrency, Integrity, Durability
c) Availability, Consistency, Isolation, Durability
d) None

Answer: a) Atomicity, Consistency, Isolation, Durability

Explanation:
ACID properties ensure reliability of database transactions:

1. Atomicity: Transaction is all-or-nothing. Either all operations succeed, or none.


2. Consistency: Database moves from one valid state to another; constraints are not violated.

3. Isolation: Concurrent transactions do not interfere with each other.

4. Durability: Once committed, changes survive system failures.

This is fundamental for relational databases.

5. Which join returns all records from left table and matching from right table?
a) INNER JOIN
b) RIGHT JOIN
c) LEFT JOIN
d) FULL JOIN

Answer: c) LEFT JOIN

Explanation:

• LEFT JOIN (or LEFT OUTER JOIN) returns:

◦ All rows from the left table

◦ Matching rows from the right table

◦ If no match → NULL for right table columns.

6. Which scheduling algorithm is preemptive?


a) First-Come First-Serve (FCFS)
b) Shortest Job First (non-preemptive)
c) Round Robin
d) None

Answer: c) Round Robin

Explanation:

• Preemptive scheduling: A process can be interrupted before it finishes to give CPU to


another process.

• Round Robin: CPU time is divided into fixed time slices (quantum); after each slice, the
next process runs → preemptive.

• FCFS & SJF (non-preemptive): Process runs till completion → non-preemptive.

7. What is the main memory overflow risk when using recursion heavily?
a) Stack overflow
b) Buffer overflow
c) Heap overflow
d) None

Answer: a) Stack overflow

Explanation:

• Recursive functions store activation records (function calls) on the call stack.

• Too many nested calls → stack exceeds memory → stack overflow.

• Buffer overflow: Memory corruption in arrays or buffers.

• Heap overflow: Running out of heap memory (dynamic allocation)

8. In object oriented terms, what is inheritance?


a) Ability to hide data
b) Ability to derive new classes from existing ones
c) Ability to write over methods
d) None

Answer: b) Ability to derive new classes from existing ones

Explanation:

• Inheritance: Mechanism to create a new class (child/subclass) from an existing class


(parent/superclass).

• Benefits: Code reuse, hierarchical relationships, polymorphism.

• Example in Java:

9. What is polymorphism in OOP?


a) Many forms, same interface
b) Single form, many interfaces
c) Hiding data
d) None

Answer: a) Many forms, same interface

Explanation:

• Polymorphism: Same method or interface behaves differently based on context.

• Types:

◦ Compile-time (overloading): Same method name, different parameters.


◦ Run-time (overriding): Subclass changes method implementation of parent.

10. What does encapsulation mean?


a) Hiding implementation details
b) Multiple form methods
c) Static binding
d) None

Answer: a) Hiding implementation details

Explanation:

• Encapsulation: Wraps data (fields) and methods into a single class and hides internal
state.

• Access is controlled via getters and setters.

• Benefits:

◦ Protects data integrity.

◦ Changes in internal implementation do not affect other parts of code.

11. What’s the difference between abstraction and encapsulation?


a) Abstraction hides complexity, encapsulation hides data
b) Abstraction hides data, encapsulation hides complexity
c) They’re same
d) None

Answer: a) Abstraction hides complexity, encapsulation hides data

Explanation:

• Abstraction: Focuses on what a class/object does, hiding the complex details from the
user.

◦ Example: A Car class may have a start() method. The user doesn’t need to know
how the engine starts internally.

• Encapsulation: Focuses on hiding the internal data and restricting access via getters/
setters.

◦ Example: private int salary in a class cannot be accessed directly; access is via
getSalary() and setSalary().

✅ Key difference: Abstraction = hides complexity, Encapsulation = hides data.


12. Which method is used to handle errors in code (in languages like Java/Python)?
a) try-catch (or try-except)
b) if else
c) loops
d) None

Answer: a) try-catch (Java) / try-except (Python)

Explanation:

• These blocks handle exceptions at runtime.

• Example in Java:

try {
int x = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Cannot divide by zero!");
}
• Example in Python:

try:
x = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero!")
• if-else cannot handle runtime exceptions; it’s only for conditional logic.

13. Which of following is NOT part of SDLC (Software Development Life Cycle)?
a) Design
b) Testing
c) Marketing
d) Maintenance

Answer: c) Marketing

Explanation:

• SDLC phases:

1. Requirement Analysis – Understand what the system should do

2. Design – Plan architecture, UI/UX, database

3. Implementation/Coding – Actual coding


4. Testing – Find and fix bugs

5. Deployment – Release to production

6. Maintenance – Updates, bug fixes

• Marketing is outside SDLC; it’s part of business strategy.

14. Which is the correct way to declare an array in Java?


a) int[] arr = new int[5];
b) int arr[5];
c) arr = int[5];
d) None

Answer: a) int[] arr = new int[5];

Explanation:

• Java requires explicit memory allocation using new.

• Syntax:

int[] arr = new int[5]; // Creates array of 5 integers


• int arr[5]; → valid in C/C++, not Java

• arr = int[5]; → invalid syntax in Java

15. Which of these is true about the module “import” in Python?


a) Used to bring functions from other files or libraries
b) Creates a new file
c) Deletes the module
d) None

Answer: a) Used to bring functions from other files or libraries

Explanation:

• import allows reusing code without rewriting.

• Example:

import math
print(math.sqrt(16)) # 4.0
• It does not create or delete files.
16. What is Big-O complexity of bubble sort (worst case)?
a) O(n)
b) O(n²)
c) O(n log n)
d) O(log n)

Answer: b) O(n²)

Explanation:

• Bubble Sort: Compare adjacent elements repeatedly and swap if needed.

• Worst case occurs when the array is reverse sorted → requires n(n-1)/2 comparisons* →
O(n²).

• Not O(n) because it requires nested loops.

17. What do you use to find memory issues in an application?


a) Debugger
b) Profiler
c) IDE
d) Compiler

Answer: b) Profiler

Explanation:

• Profiler: Tool that monitors memory usage, CPU usage, and performance.

• Helps identify memory leaks, inefficient memory allocation, or excessive object creation.

• Debugger: Helps debug logic and runtime errors, but not performance/memory
specifically.

• Compiler & IDE: Assist in development but don’t automatically detect memory issues.

18. Which of these HTTP status codes indicates internal server error?
a) 200
b) 301
c) 404
d) 500

Answer: d) 500

Explanation:
• HTTP status codes are grouped as:

◦ 1xx: Informational

◦ 2xx: Success

▪ Example: 200 OK → Request succeeded

◦ 3xx: Redirection

▪ Example: 301 Moved Permanently → Resource moved

◦ 4xx: Client errors

▪ Example: 404 Not Found → Requested resource doesn’t exist

◦ 5xx: Server errors

▪ Example: 500 Internal Server Error → Server encountered an unexpected


condition preventing it from fulfilling the request

✅ Key point: 500 → Something went wrong on the server side.

1xx – Informational

Request received, continuing process. Usually handled by the client automatically.

• 100 Continue – Server received initial request headers; client can send the body.

• 101 Switching Protocols – Server agrees to switch protocols (e.g., HTTP → WebSocket).

• 102 Processing – Server is processing the request but no response yet.

✅ Key point: 1xx = Informational responses; client should wait for final response.

2xx – Success

Request was successfully received, understood, and accepted.

• 200 OK – Request succeeded; response contains the requested data.

• 201 Created – Resource successfully created (e.g., after POST request).

• 202 Accepted – Request accepted but not yet processed.

• 204 No Content – Request succeeded but no content to return.


• 206 Partial Content – Partial content sent, used in range requests.

✅ Key point: 2xx = Success; request completed successfully.

3. 3xx – Redirection
• Further action needed by the client to complete the request.

19. 300 Multiple Choices – Multiple options for the resource.

20. 301 Moved Permanently – Resource has permanent new URL.

21. 302 Found / Moved Temporarily – Resource temporarily at a new URL.

22. 303 See Other – Redirect to another URL using GET method.

23. 304 Not Modified – Resource unchanged, can use cached version.

24. 307 Temporary Redirect – Redirect temporarily, method must not change.

25. 308 Permanent Redirect – Permanent redirect, method preserved.

✅ Key point: 3xx = Redirects.

4. 4xx – Client Errors


• Client sent an invalid request.

26. 400 Bad Request – Malformed request syntax.

27. 401 Unauthorized – Authentication required.

28. 402 Payment Required – Reserved for future use (rarely used).

29. 403 Forbidden – Server refuses to fulfill the request.

30. 404 Not Found – Requested resource not found.

31. 405 Method Not Allowed – HTTP method not allowed on the resource.

32. 406 Not Acceptable – Cannot generate response matching client’s Accept headers.

33. 407 Proxy Authentication Required – Must authenticate with a proxy.

34. 408 Request Timeout – Server timed out waiting for request.

35. 409 Conflict – Request conflicts with current state of the server.
36. 410 Gone – Resource permanently deleted.

37. 429 Too Many Requests – Client sent too many requests in a short time.

✅ Key point: 4xx = Client mistakes.

5. 5xx – Server Errors


• The server failed to fulfill a valid request.

38. 500 Internal Server Error – Generic server-side error.

39. 501 Not Implemented – Server does not recognize or support the request method.

40. 502 Bad Gateway – Server received invalid response from upstream server.

41. 503 Service Unavailable – Server temporarily unavailable (overloaded or down).

42. 504 Gateway Timeout – Server acting as gateway did not get response in time.

43. 505 HTTP Version Not Supported – HTTP version used is not supported.

44. 507 Insufficient Storage (WebDAV) – Server cannot store representation.

45. 511 Network Authentication Required – Client must authenticate to access network.

✅ Key point: 5xx = Server-side failures.

Summary Table

Cod
Category Meaning
e
Informationa
1xx Request accepted, continuing
l
2xx Success Request successfully processed
Further action required
3xx Redirection
(redirect)
4xx Client Error Client made an error in request
5xx Server Error Server failed to process request

If you want, I can also create a quick reference “cheat sheet” for all common HTTP codes with
examples of when they occur, which is extremely handy for interviews and ENTNT preparation.

Do you want me to make that?


ChatGPT can make mistakes. Check important info. See Cookie Preferences.

46. What is a foreign key in SQL?


a) Key outside database
b) A key from another table referencing primary key of that table
c) Unique key in same table
d) None

Answer: b) A key from another table referencing primary key of that table

Explanation:

• Foreign Key (FK): Ensures referential integrity between two tables.

• It points to the primary key of another table.

• Example:

CREATE TABLE Department (


DeptID INT PRIMARY KEY,
DeptName VARCHAR(50)
);

CREATE TABLE Employee (


EmpID INT PRIMARY KEY,
Name VARCHAR(50),
DeptID INT,
FOREIGN KEY (DeptID) REFERENCES Department(DeptID)
);
• Here, DeptID in Employee table is a foreign key, linking employees to departments.

47. Which of these is a primary key property?


a) Nullable
b) Unique and not null
c) Duplicate allowed
d) None

Answer: b) Unique and not null

Explanation:

• Primary Key: Uniquely identifies each row in a table.

• Properties:

◦ Cannot have null values

◦ Must be unique across all rows

• Example:

CREATE TABLE Student (


StudentID INT PRIMARY KEY, -- Unique and not null automatically
Name VARCHAR(50)
);
• Key point: Primary key = unique + not null

48. Which is correct way to delete a row in SQL?


a) REMOVE FROM table WHERE …
b) DELETE FROM table WHERE …
c) ERASE FROM table WHERE …
d) DROP FROM table WHERE …

Answer: b) DELETE FROM table WHERE …

Explanation:

• DELETE: Removes specific rows based on a condition.

• Syntax:

DELETE FROM Employee


WHERE EmpID = 101;
• DROP: Deletes the entire table.

• REMOVE/ERASE: Not valid SQL keywords.

✅ Key point: Use DELETE for rows, DROP for tables.


49. What is a closure in JavaScript?
a) A function inside function with access to outer variables even after outer finishes
b) A loop
c) Promise
d) None

Answer: a) A function inside function with access to outer variables even after outer finishes

Explanation:

• A closure is a function that "remembers" variables from its outer scope even after the
outer function has executed.

• Example:

function outer() {
let count = 0;
return function inner() {
count++;
return count;
};
}

const counter = outer();


console.log(counter()); // 1
console.log(counter()); // 2
• Here, inner() has access to count even though outer() has finished execution.

✅ Key point: Closures enable data privacy and persistent state in JS.

50. Which of following is true about Promises in JS?


a) They handle asynchronous operations
b) All promises are synchronous
c) Then is blocking
d) None

Answer: a) They handle asynchronous operations

Explanation:

• Promise: Represents future completion or failure of an asynchronous operation.

• States of a promise:

1. Pending – Initial state

2. Fulfilled – Successfully completed


3. Rejected – Failed

• Example:

let promise = new Promise((resolve, reject) => {


setTimeout(() => resolve("Done!"), 1000);
});

promise.then((value) => console.log(value)); // Logs "Done!" after 1 second


• Promises are non-blocking, meaning then() executes asynchronously when the promise
resolves.

✅ Key point: Promises make asynchronous code easier to manage than callbacks.

51. What is event loop in JS?


a) Single thread managing async callbacks
b) A loop running memory allocation
c) Thread for UI
d) None

Answer: a) Single thread managing async callbacks

Explanation:

• JavaScript is single-threaded, meaning only one piece of code executes at a time.

• The event loop allows JS to handle asynchronous operations (like timers, network
requests) without blocking the main thread.

• How it works:

1. Synchronous code executes first.

2. Async callbacks (from promises, setTimeout, I/O) go into the task queue.

3. Event loop continuously checks the queue and executes callbacks when the call
stack is empty.

✅ Key point: Event loop enables non-blocking async behavior in JS.

52. Which of the following is NOT part of HTTP protocol?


a) Request
b) Response
c) Session management
d) Headers
Answer: c) Session management

Explanation:

• HTTP is a stateless protocol, meaning it does not manage sessions by default.

• Request: Client sends data to server

• Response: Server replies

• Headers: Metadata (Content-Type, Authorization, etc.)

• Session management is typically handled on top of HTTP using cookies, tokens, or other
mechanisms, but it’s not part of the core HTTP protocol.

✅ Key point: HTTP itself is stateless; session handling is implemented separately.

53. In CSS, which property is used for responsive design?


a) display
b) flex
c) media queries
d) font-size

Answer: c) media queries

Explanation:

• Media queries allow CSS to adapt layouts for different screen sizes (desktop, tablet,
mobile).

• Example:

/* For screens smaller than 600px */


@media (max-width: 600px) {
body {
background-color: lightblue;
}
}
• Other properties like flex or display are for layout but don’t automatically respond to
screen size.

✅ Key point: Media queries = cornerstone of responsive web design.

54. What is CORS in web development?


a) Cross Origin Resource Sharing
b) Cross On Resource Server
c) Cross Origin Request Sent
d) None

Answer: a) Cross Origin Resource Sharing

Explanation:

• CORS is a security feature enforced by browsers.

• It allows a web page from one origin (domain) to access resources from another origin.

• Without CORS, browsers block cross-origin requests (same-origin policy).

• Example header sent by server:

Access-Control-Allow-Origin: https://example.com
• This tells browser: “It’s safe to allow requests from this origin.”

✅ Key point: CORS = controlled cross-origin resource access.

55. Which of these is not a primitive type in Java?


a) int
b) float
c) String
d) boolean

Answer: c) String

Explanation:

• Java primitive types are:

◦ byte, short, int, long, float, double, char, boolean

• String is an object, not a primitive type.

✅ Key point: Primitive = built-in, not objects; String = object.

56. What is null in Java?


a) Reference to no object
b) Empty string
c) Zero
d) None

Answer: a) Reference to no object


Explanation:

• null is a special literal indicating that a reference variable does not point to any object.

• Examples:

String s = null; // s points to nothing


int[] arr = null; // arr points to nothing
• null is not the same as 0 or "" (empty string).

✅ Key point: null = no object assigned.

57. Which datatype stores true/false?


a) int
b) boolean
c) char
d) string

Answer: b) boolean

Explanation:

• boolean stores only two values: true or false.

• Examples:

boolean isLoggedIn = true;


boolean hasAccess = false;
• Other types like int or char cannot store true/false directly.

58. Which of these is the output of “len([1,2,3])” in Python?


a) 2
b) 3
c) 4
d) Error

Answer: b) 3

Explanation:

• len() function returns the number of items in a collection.

• Example:
lst = [1,2,3]
print(len(lst)) # Output: 3
• Lists, strings, tuples, dictionaries can all use len().

✅ Key point: len() = size of iterable.

59. What is recursion?


a) Function calling itself directly or indirectly
b) Loop
c) Conditional
d) None

Answer: a) Function calling itself directly or indirectly

Explanation:

• Recursion: A function solves a problem by calling itself with a smaller subproblem.

• Example: Factorial function:

def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)

print(factorial(5)) # Output: 120


• Unlike loops, recursion relies on function calls and base cases to stop.

✅ Key point: Recursion = self-calling function, not a loop.

60. Which of these algorithms is used for sorting large datasets efficiently?
a) Bubble sort
b) Insertion sort
c) Merge sort
d) Selection sort

Answer: c) Merge sort

Explanation:

• Merge sort is a divide-and-conquer algorithm:

1. Divide array into two halves


2. Recursively sort each half

3. Merge sorted halves

• Time complexity: O(n log n) in all cases (best, average, worst)

• Why efficient for large datasets?

1. Performs well on large arrays because its complexity grows slowly (logarithmic
factor).

2. Works well with external sorting (sorting data that doesn’t fit into memory).

• Bubble sort, insertion sort, selection sort: O(n²) worst case → not efficient for large datasets

✅ Key point: Merge sort = efficient for large datasets.

61. In Java, what does “public static void main(String[] args)” mean?
a) Entry point of program
b) Private method
c) Loop
d) None

Answer: a) Entry point of program

Explanation:

• public: Accessible by JVM from anywhere

• static: Can run without creating an object

• void: Does not return any value

• main: Standard method name called by JVM to start execution

• String[] args: Array of command-line arguments

✅ Key point: main = program’s entry point.

62. Which of these is not a feature of Python?


a) Dynamic typing
b) Manual memory management
c) Interpreted language
d) Object oriented

Answer: b) Manual memory management


Explanation:

• Python automatically manages memory using a garbage collector.

• Features of Python:

◦ Dynamic typing: variables can change type at runtime

◦ Interpreted language: no compilation step required

◦ Object oriented: supports classes, inheritance, polymorphism

• Manual memory management (like malloc/free in C) does not exist in Python

✅ Key point: Python = automatic memory management.

63. Which of these is true about inheritance in Java?


a) Java supports multiple class inheritance
b) Java supports multiple interface inheritance
c) Java does not support interface inheritance
d) None

Answer: b) Java supports multiple interface inheritance

Explanation:

• Java does NOT allow multiple class inheritance (to avoid diamond problem)

• But a class can implement multiple interfaces → multiple interface inheritance is allowed

• Example:

interface A {}
interface B {}
class C implements A, B {} // valid
✅ Key point: Java = single class inheritance, multiple interface inheritance.

64. What is a detector of cycle in linked list algorithm’s typical approach?


a) Using Floyd’s Cycle detection (hare & tortoise)
b) Using hash set to record visited nodes
c) Modify pointers
d) Both a and b

Answer: d) Both a and b

Explanation:
• Floyd’s cycle detection (Tortoise & Hare):

◦ Two pointers move at different speeds; if they meet → cycle exists

• Hash set approach:

◦ Store visited nodes; if a node repeats → cycle exists

• Modifying pointers is generally not recommended as it alters the list

✅ Key point: Most common → Floyd’s algorithm, alternative → hash set.

65. What is the space complexity of quicksort (average / typical)?


a) O(log n)
b) O(n)
c) O(1)
d) O(n log n)

Answer: a) O(log n)

Explanation:

• Quicksort is an in-place sorting algorithm

• Average space usage: O(log n) for recursive stack calls

• Worst case: O(n) (if pivot divides unevenly)

• Does not need extra arrays for sorting (unlike merge sort)

✅ Key point: Quicksort = O(n log n) time, O(log n) space on average.

66. Which of following is true about binary tree vs binary search tree?
a) BST is a balanced tree always
b) All binary trees are BSTs
c) BST is a binary tree with ordering property
d) None

Answer: c) BST is a binary tree with ordering property

Explanation:

• Binary Tree: Each node has at most 2 children; no ordering required

• Binary Search Tree (BST):

◦ Left child < Parent < Right child


◦ Ensures efficient search O(log n) in balanced BST

• BST may or may not be balanced, so a) is wrong

• Not all binary trees are BST → b) is wrong

✅ Key point: BST = binary tree + ordering property.

67. What is heap data structure used for?


a) To get min or max quickly
b) Balanced tree building
c) Storing key-value pairs
d) None

Answer: a) To get min or max quickly

Explanation:

• A heap is a complete binary tree with a special property:

◦ Max-heap: Parent ≥ children → root has maximum value

◦ Min-heap: Parent ≤ children → root has minimum value

• Use cases:

◦ Efficient retrieval of minimum or maximum element (O(1) for root)

◦ Insertion/removal operations → O(log n)

• Not used for:

◦ Key-value storage (use hash tables)

◦ Balanced tree building (AVL or Red-Black trees do that)

✅ Key point: Heap = priority queue functionality.

68. Which of these sorting algorithms has best average performance?


a) Quick Sort
b) Insertion Sort
c) Bubble Sort
d) Selection Sort

Answer: a) Quick Sort

Explanation:
• Quick Sort:

◦ Divide-and-conquer

◦ Average time complexity: O(n log n)

◦ Worst case: O(n²) (rare, can be avoided with random pivot)

• Other algorithms:

◦ Bubble sort: O(n²)

◦ Insertion sort: O(n²)

◦ Selection sort: O(n²)

• Quick Sort is fastest on average for large arrays in memory

✅ Key point: Quick Sort = best practical average performance.

69. What does "HTTP 302" status code refer to?


a) Bad request
b) Moved temporarily (redirect)
c) Unauthorized
d) OK

Answer: b) Moved temporarily (redirect)

Explanation:

• 302 Found → the requested resource has been temporarily moved to a different URL.

• Browser/HTTP client automatically redirects to the new location.

• Other codes for context:

◦ 200 → OK

◦ 301 → Moved permanently

◦ 404 → Not found

◦ 500 → Internal server error

✅ Key point: 302 = temporary redirect.

70. Which of following are valid loops in languages like Java or Python?
a) for
b) while
c) do-while
d) all of above (depending on language)

Answer: d) all of above (depending on language)

Explanation:

• Java: Supports for, while, do-while loops

• Python: Supports for, while; does NOT have do-while

• So “all depending on language” is correct

• Loops are used to repeat code blocks based on conditions

✅ Key point: Valid loops = language dependent.

71. What is the main purpose of CSS Flexbox?


a) Layout in one dimension (row or column)
b) Layout in two dimensions
c) Coloring elements
d) None

Answer: a) Layout in one dimension (row or column)

Explanation:

• Flexbox is a CSS module designed to arrange items in a container efficiently.

• It operates in one dimension at a time: either row (horizontal) or column (vertical).

• Useful for aligning, spacing, and distributing elements inside a container.

• Not for 2D layout → For 2D, use CSS Grid.

✅ Key point: Flexbox = 1D layout management.

72. What is the punctuation at end of class declaration in Java?


a) ;
b) :
c) { }
d) None

Answer: c) { }

Explanation:
• In Java, a class body is enclosed in curly braces {}.

• Syntax:

public class MyClass {


// class members here
}
• No semicolon is required at the end of class declaration.

✅ Key point: Java class = curly braces, not ;.

73. In OOP, what is method overriding?


a) Same method in same class with different signature
b) Subclass provides its own implementation for method from parent class
c) Changing method name
d) None

Answer: b) Subclass provides its own implementation for method from parent class

Explanation:

• Method overriding occurs when a child class defines a method with the same signature as
a method in its parent class.

• Allows runtime polymorphism, meaning the child class’s method will be called instead of
the parent’s.

• Key distinction: Overriding = same name + same parameters, different implementation.

✅ Key point: Overriding = runtime polymorphism.

74. What is the difference between stack and heap memory?


a) Stack is for primitives/local calls, heap for dynamic allocation
b) Heap is smaller than stack always
c) Stack grows downward, heap upward (language dependent)
d) Both a & c

Answer: d) Both a & c

Explanation:

Feature Stack Heap


Local variables, function
Memory type Dynamically allocated objects
calls
Allocation/ Manual (new/delete in C++, GC in
LIFO, automatic
Deallocation Java)
Growth Typically downward Typically upward
Speed Fast Slower

✅ Key point: Stack = short-lived, local, Heap = dynamic, global

75. What is the meaning of SQL transaction?


a) A single SQL query
b) A group of SQL operations that are atomic
c) A selection of records
d) None

Answer: b) A group of SQL operations that are atomic

Explanation:

• Transaction: A set of operations that either all succeed or all fail.

• Follows ACID properties:

◦ Atomicity: All or nothing

◦ Consistency: Data remains valid

◦ Isolation: Transactions don’t interfere

◦ Durability: Changes persist after commit

✅ Key point: Transaction = atomic block of SQL operations.

76. What is the output of this code snippet in Javascript:

console.log(typeof NaN);
a) "number"
b) "NaN"
c) "undefined"
d) “object"

Answer: a) "number"

Explanation:

• NaN stands for Not a Number, but its type is still number in JS.

• Example:
console.log(typeof NaN); // "number"
• This is quirk of JavaScript; NaN is technically a numeric value representing an invalid
number.

✅ Key point: typeof NaN = "number" in JS.

67. What does CSS selector #id target?


a) Class
b) Id
c) Tag
d) Attribute

Answer: b) Id

Explanation:

• # in CSS → targets element with specific id.

#header {
background-color: blue;
}
• .class → targets class, tag → targets element name.

✅ Key point: #id = unique element targeting.

68. Which of the following is true about HTTP/1.1 keep alive?


a) Each request opens new connection
b) Reuse connection for multiple requests
c) Depreciated feature
d) None

Answer: b) Reuse connection for multiple requests

Explanation:

• Keep-alive (persistent connections) allows multiple HTTP requests/responses over same


TCP connection.

• Reduces connection overhead, improves performance.

• By default, HTTP/1.1 uses keep-alive.

✅ Key point: Keep-alive = connection reuse.


69. What is SQL injection primarily attacking?
a) Data loss
b) Unauthorized actions via dangerous input forming queries
c) Memory leak
d) Cross-site scripting

Answer: b) Unauthorized actions via dangerous input forming queries

Explanation:

• SQL injection = attacker injects malicious SQL code via input fields.

• Can read, modify, delete data unauthorized.

• Prevent using parameterized queries / prepared statements.

✅ Key point: SQL injection = input-based database attack.

70. Which of the following is NOT an HTTP method?


a) OPTIONS
b) TRACE
c) LISTEN
d) CONNECT

Answer: c) LISTEN

Explanation:

• Valid HTTP methods: GET, POST, PUT, DELETE, PATCH, OPTIONS, TRACE,
CONNECT

• LISTEN is not a standard HTTP method.

✅ Key point: LISTEN = invalid HTTP method.

71. What is localhost address?


a) 127.0.0.1
b) 0.0.0.0
c) ::1
d) Both a & c

Answer: d) Both a & c

Explanation:
• 127.0.0.1 → IPv4 loopback

• ::1 → IPv6 loopback

• 0.0.0.0 → Bind to all network interfaces (not localhost)

✅ Key point: Localhost = 127.0.0.1 (IPv4), ::1 (IPv6)

72. What does “git merge” do?


a) Combines two commit histories
b) Deletes a branch
c) Resets repository to earlier commit
d) None

Answer: a) Combines two commit histories

Explanation:

• git merge branch_name → merges another branch’s commits into current branch.

• Preserves history, may create merge commit.

• Not for deleting branches (git branch -d) or resetting (git reset).

✅ Key point: git merge = merge histories, combine code changes.

73. Which is correct for removing all leading and trailing whitespace in Python?
a) strip()
b) trim()
c) ltrim() & rtrim()
d) None

Answer: a) strip()

Explanation:

• In Python, the strip() method removes leading and trailing whitespace from a string.

text = " hello world "


clean_text = text.strip() # "hello world"
• lstrip() → removes leading spaces

• rstrip() → removes trailing spaces

• trim() does not exist in Python (it exists in JavaScript).


✅ Key point: Use strip() to remove spaces from both ends.

74. In JavaScript, which symbol is used to declare a template literal?


a) "
b) ` (backtick)
c) '
d) ~

Answer: b) ` (backtick)

Explanation:

• Template literals allow string interpolation and multi-line strings.

let name = "Aman";


console.log(`Hello, ${name}!`); // Hello, Aman!
• Regular quotes " " or ' ' cannot interpolate variables.

• Backticks are unique to template literals.

✅ Key point: Backticks = template literal + interpolation.

75. What is caching in computer systems?


a) Storing frequently used values for faster access
b) Copying data to external storage
c) Transferring files over network
d) None

Answer: a) Storing frequently used values for faster access

Explanation:

• Cache is a high-speed storage (CPU cache, disk cache, browser cache)

• Stores frequently accessed data to reduce access time.

• Example: Web browser caching images to load pages faster.

✅ Key point: Cache = speed optimization for repeated access.

76. What is RAID used for?


a) Data redundancy and/or performance improvement in storage systems
b) Network routing
c) Processor management
d) None

Answer: a) Data redundancy and/or performance improvement in storage systems

Explanation:

• RAID (Redundant Array of Independent Disks) combines multiple hard drives to:

◦ Increase fault tolerance (redundancy)

◦ Improve performance (striping)

• Example: RAID 1 → mirroring, RAID 0 → striping

✅ Key point: RAID = storage redundancy & performance.

77. Which of the following is a characteristic of Agile methodology?


a) Fixed requirements throughout
b) Frequent delivery of small increments
c) Heavy documentation upfront
d) No customer feedback

Answer: b) Frequent delivery of small increments

Explanation:

• Agile emphasizes:

◦ Iterative development

◦ Continuous delivery

◦ Customer collaboration

• Opposite of Waterfall → requirements can evolve, documentation is minimal upfront.

✅ Key point: Agile = flexible, incremental, iterative.

78. What is continuous integration (CI)?


a) Combining code from different developers frequently
b) Deployment to production
c) Writing tests
d) None

Answer: a) Combining code from different developers frequently

Explanation:
• CI is a development practice where:

◦ Developers merge code changes into a shared repository frequently

◦ Automated builds and tests run to detect integration issues early.

• Deployment is a separate step (Continuous Deployment/Delivery).

✅ Key point: CI = frequent integration + automated testing.

79. Which of the following is a form of non-preemptive scheduling?


a) Round Robin
b) FCFS (non-preemptive)
c) Priority (preemptive)
d) SJF (preemptive)

Answer: b) FCFS (non-preemptive)

Explanation:

• Non-preemptive scheduling: A process runs to completion once started.

• FCFS (First Come, First Serve) → processes are executed in order of arrival.

• Preemptive algorithms (like Round Robin, preemptive SJF) can interrupt running
processes.

✅ Key point: FCFS = classic non-preemptive scheduler.

80. What is a race condition?


a) Condition where program runs faster than expected
b) When two threads/processes access shared data concurrently and results depend on order
c) A loop that never ends
d) None

Answer: b) When two threads/processes access shared data concurrently and results depend
on order

Explanation:

• Race condition occurs in concurrent programming.

• If two threads modify the same data simultaneously, the output may vary depending on
timing.

• Avoid using mutexes, locks, or atomic operations.


✅ Key point: Race condition = unpredictable results due to concurrent access.

81. Which is true about MVC architecture?


a) Model handles data logic
b) View handles display
c) Controller handles input logic
d) All of the above

Answer: d) All of the above

Explanation:

• MVC (Model-View-Controller) design pattern separates concerns:

◦ Model: Manages data and business logic

◦ View: Handles UI/display

◦ Controller: Handles input and updates Model/View

✅ Key point: MVC = separation of concerns.

82. Which of these terms relates to SOLID principles?


a) Single Responsibility
b) Open/Closed
c) Liskov Substitution
d) All of the above

Answer: d) All of the above

Explanation:

• SOLID = five design principles in OOP:

◦ S: Single Responsibility

◦ O: Open/Closed

◦ L: Liskov Substitution

◦ I: Interface Segregation

◦ D: Dependency Inversion

✅ Key point: SOLID → guidelines for maintainable OOP design.


83. What is the difference between interface and abstract class?
a) Interfaces can have method implementations (depending on language)
b) Abstract classes can have state (fields), interfaces may not (depending on language)
c) A class can implement multiple interfaces but extend only one abstract class (in many
languages
d) All of above

Answer: d) All of above

Explanation:

• Interface:

◦ Only declares methods (some languages allow default implementations).

◦ No instance variables (state).

◦ A class can implement multiple interfaces.

• Abstract class:

◦ Can have methods with implementation and fields.

◦ A class can extend only one abstract class (single inheritance).

✅ Key point: Interface = contract, Abstract class = partial implementation + state

84. Which of these is true about function overloading vs over-riding?


a) Overloading: same method name, different parameters; Overriding: subclass changes
implementation
b) Overloading: subclass changes implementation; Overriding: same name/different
parameters
c) They’re same
d) None

Answer: a) Overloading: same method name, different parameters; Overriding: subclass


changes implementation

Explanation:

• Function/Method Overloading:

◦ Same method name, different parameter types or counts within the same class.

◦ Compile-time polymorphism (resolved at compile time).


class Demo {
• void show(int a) { System.out.println(a); }
• void show(String s) { System.out.println(s); }
• }

• Function/Method Overriding:

◦ Subclass provides its own implementation of a method defined in parent class.

◦ Runtime polymorphism (resolved at runtime).


class Parent {

• void display() { System.out.println("Parent"); }


• }
• class Child extends Parent {
• void display() { System.out.println("Child"); } // overriding
• }

✅ Key point:

• Overloading = same name, different parameters

• Overriding = same name & parameters, different implementation in subclass

85. In memory, what is fragmentation?


a) Broken files on disk
b) Memory blocks wasted due to loose allocation
c) Overwriting memory
d) None

Answer: b) Memory blocks wasted due to loose allocation

Explanation:

• Fragmentation occurs when memory is divided into small blocks that cannot be
efficiently used:

◦ Internal fragmentation: allocated memory is slightly larger than requested →


wasted space inside block

◦ External fragmentation: free memory scattered in small chunks → cannot allocate


large blocks even if total memory is sufficient

• Example: Allocating memory for processes in RAM, gaps appear between allocated blocks.
✅ Key point: Fragmentation = wasted memory due to poor allocation.

86. Which is true about virtual memory?


a) Allows programs to use more memory than physically available
b) Slower than physical memory access
c) Managed by OS
d) All of the above

Answer: d) All of the above

Explanation:

• Virtual memory is a memory management technique where:

◦ Programs can use more memory than physical RAM (by using disk space as
extension).

◦ Slower than RAM because disk access is slower.

◦ Operating System manages mapping between virtual addresses and physical


memory.

• Example: Paging and swapping are virtual memory techniques.

✅ Key point: Virtual memory = more addressable memory + OS management + slower access

87. Which scheduling algorithm minimizes average waiting time if all processes arrive at same
time?
a) FCFS
b) SJF (non-preemptive)
c) Round Robin
d) Priority

Answer: b) SJF (non-preemptive)

Explanation:

• SJF (Shortest Job First):

◦ Processes with shortest burst time executed first.

◦ Minimizes average waiting time because short processes don’t wait behind long
ones.

• Example:
• Burst

Time
• P1 • 5
• P2 • 2
• P3 • 8

◦ FCFS: Average waiting time = (0 + 5 + 7) / 3 = 4.67

◦ SJF: Order P2, P1, P3 → Waiting time = (0 + 2 + 7) / 3 = 3 → lower!

✅ Key point: Non-preemptive SJF = optimal for average waiting time when all arrive
simultaneously.

88. In software testing, what is the difference between unit testing and integration testing?
a) Unit tests test individual components; integration tests test combined parts
b) Integration tests test a single component; unit tests test all together
c) Both are same
d) None

Answer: a) Unit tests test individual components; integration tests test combined parts

Explanation:

• Unit Testing:

◦ Tests individual modules or functions in isolation.

◦ Focus: correctness of smallest code unit.

◦ Tools: JUnit (Java), pytest (Python).

• Integration Testing:

◦ Tests interaction between modules.

◦ Focus: whether components work together correctly.

◦ Example: testing database + API module interaction.

✅ Key point: Unit = small pieces; Integration = combined pieces.

89. Which tool is used for continuous integration?


a) Jenkins
b) Travis CI
c) GitHub Actions
d) All of the above
Answer: d) All of the above

Explanation:

• Continuous Integration (CI): process of automatically building, testing, and validating


code whenever changes are pushed.

• Tools:

◦ Jenkins: open-source CI/CD automation tool.

◦ Travis CI: cloud-based CI service for GitHub projects.

◦ GitHub Actions: CI/CD directly integrated with GitHub repos.

✅ Key point: All three are popular CI tools.

90. What is the principle of DRY (Don't Repeat Yourself)?


a) Write code twice to ensure correctness
b) Avoid duplication of logic/code
c) Repeat modules if necessary
d) None

Answer: b) Avoid duplication of logic/code

Explanation:

• DRY principle: Every piece of knowledge or logic should have a single, unambiguous
representation.

• Benefits: easier maintenance, fewer bugs.

• Example: Instead of writing calculateTax() logic in multiple classes, define it once and
reuse.

✅ Key point: DRY = reduce duplication.

91. What is idempotency in REST APIs?


a) Multiple same requests have same effect as single request
b) Requests always error out
c) Requests are always successful
d) None

Answer: a) Multiple same requests have same effect as single request

Explanation:
• Idempotent API: performing the same operation multiple times yields the same result.

• Examples:

◦ GET /users/1 → fetching user always gives same output.

◦ PUT /users/1 → updating same fields repeatedly doesn’t change outcome after first
update.

• Non-idempotent: POST requests that create new resources.

✅ Key point: Idempotent = safe to repeat without side effects.

92. Which of the following is correct about SQL indexes?


a) Speed up query performance
b) Slow down insert/update operations
c) Use extra space
d) All of the above

Answer: d) All of the above

Explanation:

• Indexes: data structures (like B-trees) that speed up searches.

• Pros: Queries (SELECT) are faster.

• Cons:

◦ Inserts/Updates/Deletes are slightly slower due to index maintenance.

◦ Requires additional storage for the index.

✅ Key point: Index = tradeoff: faster reads, slower writes, extra space.

93. What is “mutex” used for?


a) Mutual exclusion in concurrent programming
b) Memory allocation
c) Sorting
d) None

Answer: a) Mutual exclusion in concurrent programming

Explanation:

• Mutex (Mutual Exclusion object): prevents race conditions by allowing only one thread
at a time to access shared resources.
• Example: two threads writing to same file → mutex prevents conflicts.

✅ Key point: Mutex = thread safety mechanism.

94. Which of following is true about big-data?


a) Only relational databases used
b) Data distributed across machines
c) Data processed only in memory
d) None

Answer: b) Data distributed across machines

Explanation:

• Big Data characteristics:

◦ Volume, Variety, Velocity, Veracity (4Vs).

◦ Processed using distributed storage/processing systems like Hadoop, Spark.

• Not limited to relational databases; can use NoSQL.

✅ Key point: Big Data = distributed, large-scale data processing.

95. What is CAP theorem in distributed systems?


a) Consistency, Availability, Partition tolerance
b) Concurrent, Accessible, Performance
c) Correctness, Accuracy, Partition
d) None

Answer: a) Consistency, Availability, Partition tolerance

Explanation:

• CAP Theorem: In a distributed system, you can guarantee at most 2 of 3:

◦ Consistency (C): all nodes see same data at same time.

◦ Availability (A): every request receives a response.

◦ Partition tolerance (P): system continues despite network failures.

• Example: NoSQL DBs like MongoDB may favor AP or CP depending on configuration.

✅ Key point: CAP = tradeoff between consistency, availability, partition tolerance.


96. Which of these is a distributed version control system?
a) SVN
b) Git ✅
c) CVS
d) RCS

Answer: b) Git

Explanation:

• Distributed Version Control System (DVCS): Every developer has a full copy of the
repository, including history.

• Git:

◦ DVCS, widely used for modern software development.

◦ Allows offline work, branching, and merging easily.

• SVN (Subversion), CVS, RCS: Centralized VCS → rely on a central repository.

✅ Key point: Git = distributed; SVN/CVS = centralized.

97. Which of the following is NOT true about HTTPS?


a) It encrypts data in transit
b) Uses TLS/SSL protocol
c) Runs on port 80
d) Ensures integrity of data

Answer: c) Runs on port 80

Explanation:

• HTTPS (HyperText Transfer Protocol Secure):

◦ Uses TLS/SSL to encrypt communication.

◦ Ensures data confidentiality, integrity, and authentication.

◦ Default port: 443, not 80.

• Port 80 is for HTTP (unencrypted).

✅ Key point: HTTPS = encrypted, secure, port 443.

98. Which type of loop will run at least once even if the condition is false (in some languages)?
a) for
b) while
c) do-while
d) foreach

Answer: c) do-while

Explanation:

• do-while loop:

◦ Executes the loop body first, then checks the condition.

◦ Ensures at least one execution, even if the condition is false.

• while / for:

◦ Condition is checked before execution → may run 0 times.

✅ Key point: do-while = execute first, check later.

99. What is a pointer?


a) Variable that stores data directly
b) Variable that stores address of another variable
c) Variable that stores type
d) None

Answer: b) Variable that stores address of another variable

Explanation:

• Pointer: stores memory address of another variable instead of the value itself.

• Usage:

◦ Dynamic memory allocation (malloc, new).

◦ Passing large structures efficiently.

◦ Implementing linked data structures (linked list, tree).

✅ Key point: Pointer = address holder.

100. Which is the correct way to comment a single line in C++?


a) // comment
b) /* comment */
c) # comment

Answer: a) // comment
Explanation:

• C++ single-line comment: // → everything after // on that line is ignored.

• Multi-line comment: /* ... */ → spans multiple lines.

• # comment: used in scripting languages like Python, Bash, not C++.

✅ Key point: // = single-line comment; /* */ = multi-line comment.

1. Which data structure is used in BFS traversal of a graph?

a) Stack

b) Queue

c) Linked list

d) Priority queue

Correct Answer: b) Queue

Options explanation:

• a) Stack – Stack is used in depth-first search (DFS), not BFS. Stack follows LIFO (Last In
First Out), which explores one path deeply before backtracking.

• b) Queue – ✅ Correct. BFS uses a queue to explore neighbors in order of discovery. The
first node added is the first to be processed.

• c) Linked list – A linked list is a general-purpose data structure but not specific to BFS
traversal. It does not inherently provide the order mechanism BFS needs.
• d) Priority queue – Priority queues are used when elements need to be processed based on
priority, like in Dijkstra’s algorithm, but BFS uses a simple FIFO queue.

2. Which traversal technique uses recursion naturally?

a) BFS

b) DFS

c) Level-order

d) None

Correct Answer: b) DFS

Options explanation:

• a) BFS – BFS doesn’t use recursion naturally; it relies on a queue structure.

• b) DFS – ✅ Correct. DFS explores nodes deeply before backtracking, and recursion easily
supports this by using the call stack.

• c) Level-order – Level-order traversal is essentially BFS and doesn’t fit naturally with
recursion.

• d) None – ❌ Incorrect, because DFS does use recursion in its common implementations.

3. Which of the following is a stable sorting algorithm?

a) Quick Sort

b) Heap Sort

c) Bubble Sort

d) Selection Sort

Correct Answer: c) Bubble Sort

Options explanation:

• a) Quick Sort – ❌ Not stable by default. Quick Sort’s swapping may change the relative
order of equal elements.

• b) Heap Sort – ❌ Also unstable because elements are reordered while heapifying.
• c) Bubble Sort – ✅ Correct. It only swaps elements when necessary and preserves the
order of equal elements.

• d) Selection Sort – ❌ Unstable because it may swap elements that are equal but out of
order.

4. What is the worst-case time complexity of Quick Sort?

a) O(n)

b) O(n log n)

c) O(n²)

d) O(log n)

Correct Answer: c) O(n²)

Options explanation:

• a) O(n) – ❌ Not possible; sorting requires at least O(n log n) comparisons in the general
case.

• b) O(n log n) – ❌ This is the average-case complexity, not the worst case.

• c) O(n²) – ✅ Correct. If the pivot is poorly chosen, Quick Sort degenerates into a form of
selection sort where each partition is highly unbalanced.

• d) O(log n) – ❌ Sorting algorithms can't achieve this time complexity in the wors

5. Which of the following is a characteristic of a linked list?

a) Fixed size

b) Dynamic memory allocation

c) Random access

d) None

Correct Answer: b) Dynamic memory allocation

Options explanation:

• a) Fixed size – ❌ Arrays have a fixed size, whereas linked lists grow dynamically.

• b) Dynamic memory allocation – ✅ Correct. Nodes are allocated as needed, allowing


flexibility in size.
• c) Random access – ❌ Linked lists don’t support direct access like arrays; you must
traverse from the head.

• d) None – ❌ Incorrect because linked lists do have defining characteristics like dynamic
allocation.

6. Which tree is always balanced?

a) Binary Tree

b) Binary Search Tree

c) AVL Tree

d) Heap

Correct Answer: c) AVL Tree

Options explanation:

• a) Binary Tree – ❌ No balancing constraints; can become skewed.

• b) Binary Search Tree (BST) – ❌ Doesn’t enforce balancing; performance may degrade.

• c) AVL Tree – ✅ Correct. It’s a self-balancing BST ensuring height difference between left
and right subtrees is at most 1.

• d) Heap – ❌ A heap is partially ordered but not necessarily balanced.

7. Which data structure uses LIFO principle?

a) Queue

b) Stack

c) Graph

d) Tree

Correct Answer: b) Stack

Options explanation:

• a) Queue – ❌ Follows FIFO (First In First Out), not LIFO.

• b) Stack – ✅ Correct. Stack pushes and pops from the same end, making it LIFO.
• c) Graph – ❌ Graphs are structures of nodes and edges without ordering constraints like
LIFO.

• d) Tree – ❌ Trees are hierarchical structures; LIFO doesn’t directly apply.

8. Which of the following is true for a circular queue?

a) Front and rear never wrap around

b) Memory is wasted

c) Rear wraps around to front when full

d) Cannot be implemented with array

Correct Answer: c) Rear wraps around to front when full

Options explanation:

• a) Front and rear never wrap around – ❌ Incorrect; circular queues specifically allow
wrapping.

• b) Memory is wasted – ❌ Circular queues are designed to efficiently reuse space.

• c) Rear wraps around to front when full – ✅ Correct. This reuse of space is the defining
feature of circular queues.

• d) Cannot be implemented with array – ❌ Incorrect; circular queues are often


implemented using arrays with modulo arithmetic.

9. Which graph algorithm can detect negative weight cycles?

a) Dijkstra

b) BFS

c) Bellman-Ford

d) Prim

Correct Answer: c) Bellman-Ford

Options explanation:

• a) Dijkstra – ❌ Doesn't work with negative weights.


• b) BFS – ❌ BFS is for unweighted graphs and doesn’t account for weights.

• c) Bellman-Ford – ✅ Correct. It can detect negative cycles by checking for further


relaxation after n - 1 iterations.

• d) Prim – ❌ Used for minimum spanning trees, doesn’t detect cycles.

10. What is the minimum number of edges in a connected graph with n vertices?

a) n

b) n-1

c) n+1

d) 2n

Correct Answer: b) n - 1

Options explanation:

• a) n – ❌ Incorrect; adding n edges may create cycles.

• b) n-1 – ✅ Correct. A tree with n vertices has exactly n - 1 edges, which is the minimum
for connectivity without cycles.

• c) n+1 – ❌ Incorrect; more than necessary for connectivity.

• d) 2n – ❌ Incorrect; far more than the required edges for connectivity.

11. Which of these is NOT a hashing collision resolution technique?

a) Chaining

b) Open addressing

c) Linear probing

d) DFS

Correct Answer: d) DFS

Options explanation:
• a) Chaining – ✅ Correct collision resolution technique. Uses linked lists (or other
structures) at each hash index to store multiple elements that map to the same location.

• b) Open addressing – ✅ Correct technique where, in case of collision, the algorithm


searches for the next available slot in the hash table.

• c) Linear probing – ✅ A specific open addressing method where it checks the next slot
sequentially until an empty one is found.

• d) DFS (Depth-First Search) – ❌ Not related to hashing or collision resolution. DFS is a


graph traversal algorithm used for exploring nodes.

12. Which of these is a type of NoSQL database?

a) Key-Value

b) Document

c) Columnar

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Key-Value – ✅ NoSQL database storing data as key-value pairs (e.g., Redis).

• b) Document – ✅ NoSQL database storing structured documents like JSON or BSON


(e.g., MongoDB).

• c) Columnar – ✅ NoSQL type that stores data in columns rather than rows for analytics
(e.g., Cassandra).

• d) All of the above – ✅ Correct because all the listed types are used in different NoSQL
databases.

13. Which SQL constraint prevents duplicate entries?

a) PRIMARY KEY

b) UNIQUE

c) FOREIGN KEY
d) CHECK

Correct Answer: b) UNIQUE

Options explanation:

• a) PRIMARY KEY – ✅ Prevents duplicates and NULLs. It uniquely identifies each


record.

• b) UNIQUE – ✅ Correct. It ensures that values in a column or set of columns are unique
but allows NULL values unless otherwise constrained.

• c) FOREIGN KEY – ❌ Used to enforce referential integrity, not prevent duplicates.

• d) CHECK – ❌ Ensures values satisfy a specific condition but doesn't prevent duplicates
by itself.

14. Which SQL command is used to remove a table completely?

a) DELETE

b) DROP

c) TRUNCATE

d) REMOVE

Correct Answer: b) DROP

Options explanation:

• a) DELETE – ❌ Removes rows from a table but leaves the table structure intact.

• b) DROP – ✅ Correct. Deletes the entire table and its structure from the database.

• c) TRUNCATE – ❌ Removes all rows but keeps the table structure and schema.

• d) REMOVE – ❌ Not a valid SQL command.

15. Which of these commands initializes a new Git repository?

a) git clone

b) git init

c) git add
d) git commit

Correct Answer: b) git init

Options explanation:

• a) git clone – ❌ Used to copy an existing repository to a new local folder.

• b) git init – ✅ Correct. Initializes a new Git repository in the current folder.

• c) git add – ❌ Stages files to be committed but doesn’t create the repository itself.

• d) git commit – ❌ Records staged changes but doesn’t initialize a repository.

16. What is the output of `typeof null` in JavaScript?

a) "null"

b) "object"

c) "undefined"

d) "boolean"

Correct Answer: b) "object"

Options explanation:

• a) "null" – ❌ Intuitively it seems it should return "null", but that’s not how JavaScript
works.

• b) "object" – ✅ Correct. Due to a historical bug in JavaScript, typeof null returns


"object".

• c) "undefined" – ❌ Incorrect. Undefined refers to a variable declared but not initialized.

• d) "boolean" – ❌ Incorrect. Boolean only refers to true or false values.

17. Which CSS property is used for font size?

a) font-weight

b) font-size

c) font-style
d) font-family

Correct Answer: b) font-size

Options explanation:

• a) font-weight – ❌ Controls the thickness of text, not size.

• b) font-size – ✅ Correct. Sets the size of the text.

• c) font-style – ❌ Controls style (italic, oblique), not size.

• d) font-family – ❌ Specifies the font type (like Arial or Times), not size.

18. Which of these is NOT a valid CSS unit?

a) px

b) em

c) pt

d) db

Correct Answer: d) db

Options explanation:

• a) px – ✅ Pixel unit, widely used for precise control.

• b) em – ✅ Relative unit based on the current font size.

• c) pt – ✅ Point unit, often used in print styles.

• d) db – ❌ ❌ Invalid CSS unit. There’s no "db" unit in CSS.

19. Which HTTP status code represents “Created”?

a) 200

b) 201

c) 204
d) 404

Correct Answer: b) 201

Options explanation:

• a) 200 – ❌ OK; standard success response.

• b) 201 – ✅ Correct. Indicates that a resource has been successfully created.

• c) 204 – ❌ No Content; operation successful but no response body.

• d) 404 – ❌ Not Found; indicates that the resource could not be found.

20. Which HTTP method is **not idempotent**?

a) GET

b) PUT

c) POST

d) DELETE

Correct Answer: c) POST

Options explanation:

• a) GET – ✅ Idempotent. Repeated requests don’t change the server state.

• b) PUT – ✅ Idempotent. Repeated requests overwrite or create the same resource, with no
side effects.

• c) POST – ❌ Not idempotent. Repeated requests create multiple resources or trigger other
side effects.

• d) DELETE – ✅ Idempotent. Repeated deletion requests result in the same state: resource
removed or already absent.

21. Which of the following is NOT a JavaScript data type?

a) Number

b) String
c) Char

d) Boolean

Correct Answer: c) Char

Options explanation:

• a) Number – ✅ JavaScript uses the Number type for all numeric values, including
integers and floats.

• b) String – ✅ Used to represent sequences of characters.

• c) Char – ❌ Incorrect. JavaScript doesn’t have a separate Char data type like Java or C; it
uses String for individual characters.

• d) Boolean – ✅ Used for true or false values.

22. Which keyword in Java is used to inherit a class?

a) implement

b) extends

c) inherits

d) super

Correct Answer: b) extends

Options explanation:

• a) implement – ❌ Used when a class implements an interface, not for inheritance.

• b) extends – ✅ Correct. Used for subclassing one class from another.

• c) inherits – ❌ Not a valid Java keyword.

• d) super – ❌ Refers to the parent class, but it’s not used to declare inheritance.

23. Which keyword is used to define an interface in Java?

a) abstract

b) interface
c) implements

d) extends

Correct Answer: b) interface

Options explanation:

• a) abstract – ❌ Defines abstract classes, not interfaces.

• b) interface – ✅ Correct. Used to define an interface that classes can implement.

• c) implements – ❌ Used to implement an interface, not to define one.

• d) extends – ❌ Used when an interface inherits from another interface or a class inherits
from another class.

24. Which of these can implement multiple inheritance in Java?

a) Class

b) Interface

c) Abstract class

d) None

Correct Answer: b) Interface

Options explanation:

• a) Class – ❌ Java doesn’t allow multiple inheritance for classes to avoid ambiguity
(diamond problem).

• b) Interface – ✅ Correct. A class can implement multiple interfaces.

• c) Abstract class – ❌ Java only allows a class to inherit from one abstract class.

• d) None – ❌ Incorrect because interfaces support multiple inheritance.

25. Which access modifier allows members to be accessed anywhere?

a) private

b) protected
c) public

d) default

Correct Answer: c) public

Options explanation:

• a) private – ❌ Limits access to the defining class only.

• b) protected – ❌ Allows access within the same package and subclasses.

• c) public – ✅ Correct. Makes the member accessible from anywhere in the program.

• d) default – ❌ Package-private by default; accessible only within the same package.

26. Which method is used to start a thread in Java?

a) start()

b) run()

c) execute()

d) begin()

Correct Answer: a) start()

Options explanation:

• a) start() – ✅ Correct. Creates a new thread and invokes its run() method.

• b) run() – ❌ Defines the task for the thread but doesn’t start it.

• c) execute() – ❌ Not a method in the Thread class.

• d) begin() – ❌ Not a method in Java for threads.

27. Which of these is true about multithreading?

a) Threads share process memory

b) Threads have independent memory


c) Threads are always sequential

d) Threads cannot share data

Correct Answer: a) Threads share process memory

Options explanation:

• a) Threads share process memory – ✅ Correct. Threads within the same process share
the same memory space, enabling faster communication.

• b) Threads have independent memory – ❌ Incorrect. Threads share memory; only


separate processes have isolated memory.

• c) Threads are always sequential – ❌ Incorrect. Threads can run concurrently or in


parallel.

• d) Threads cannot share data – ❌ Incorrect. Threads are designed to share data and
resources within a process.

28. What is the default value of a boolean in Java?

a) true

b) false

c) null

d) 0

Correct Answer: b) false

Options explanation:

• a) true – ❌ Incorrect; default is false.

• b) false – ✅ Correct. Boolean fields are initialized to false by default.

• c) null – ❌ ❌ Primitive types like boolean cannot be null.

• d) 0 – ❌ Incorrect; 0 is numeric, not boolean.


29. Which of these are principles of OOP?

a) Encapsulation

b) Inheritance

c) Polymorphism

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Encapsulation – ✅ Correct. Hides the internal state and requires all interactions
through methods.

• b) Inheritance – ✅ Correct. Allows classes to inherit properties and methods from other
classes.

• c) Polymorphism – ✅ Correct. Allows one interface to be used for different underlying


forms (e.g., method overloading).

• d) All of the above – ✅ Correct. These are core principles of object-oriented


programming.

30. Which of the following is a non-preemptive CPU scheduling algorithm?

a) Round Robin

b) FCFS

c) Priority (preemptive)

d) SJF (preemptive)

Correct Answer: b) FCFS

Options explanation:

• a) Round Robin – ❌ Preemptive. Time slices are used, and the CPU switches between
processes at regular intervals.

• b) FCFS (First Come, First Served) – ✅ Correct. Processes are executed in the order
they arrive without interruption.

• c) Priority (preemptive) – ❌ Preemptive. Higher-priority processes can interrupt others.


• d) SJF (preemptive) – ❌ Preemptive. If a shorter job arrives, it can interrupt the current
job.

31. Which scheduling algorithm is suitable for time-sharing systems?

a) FCFS

b) Round Robin

c) SJF

d) Priority

Correct Answer: b) Round Robin

Options explanation:

• a) FCFS (First Come, First Served) – ❌ Not suitable for time-sharing systems because it
doesn't ensure fairness or responsiveness.

• b) Round Robin – ✅ Correct. Time-sharing systems require fair CPU allocation and
responsiveness. Round Robin gives each process a fixed time slice, rotating among all
processes.

• c) SJF (Shortest Job First) – ❌ Not suitable because it favors short tasks and may starve
longer tasks.

• d) Priority – ❌ Can lead to starvation if lower-priority processes are not given CPU time.

32. What is the maximum value of an unsigned 8-bit integer?

a) 127

b) 255

c) 256

d) 128

Correct Answer: b) 255

Options explanation:

• a) 127 – ❌ This is the maximum for a signed 8-bit integer (-128 to 127).

• b) 255 – ✅ Correct. An unsigned 8-bit integer can represent 0 to 2⁸ - 1, i.e., 0 to 255.


• c) 256 – ❌ ❌ Incorrect. The range ends at 255.

• d) 128 – ❌ Incorrect. This is halfway, not the maximum.

33. Which of these is a logical operator in C/C++?

a) &&

b) ||

c) !

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) && (Logical AND) – ✅ Combines two conditions; true if both are true.

• b) || (Logical OR) – ✅ Combines two conditions; true if at least one is true.

• c) ! (Logical NOT) – ✅ Inverts the truth value; true becomes false and vice versa.

• d) All of the above – ✅ Correct. All three are logical operators used for decision-making
in C/C++.

34. Which of these is true about TCP?

a) Connectionless

b) Reliable and connection-oriented

c) Unreliable

d) Only used for multicast

Correct Answer: b) Reliable and connection-oriented

Options explanation:

• a) Connectionless – ❌ Incorrect. Connectionless refers to protocols like UDP.

• b) Reliable and connection-oriented – ✅ Correct. TCP establishes a connection and


ensures data delivery without errors.
• c) Unreliable – ❌ Incorrect. TCP guarantees reliable delivery.

• d) Only used for multicast – ❌ Incorrect. TCP is used for point-to-point connections, not
multicast.

35. Which layer of OSI handles routing?

a) Transport

b) Network

c) Data Link

d) Application

Correct Answer: b) Network

Options explanation:

• a) Transport – ❌ Handles end-to-end communication but not routing.

• b) Network – ✅ Correct. The network layer (e.g., IP) determines the path data takes to
reach its destination.

• c) Data Link – ❌ Handles error detection and framing within the same network segment.

• d) Application – ❌ Provides services directly to users but doesn’t handle routing.

36. Which layer of OSI is responsible for encryption?

a) Network

b) Presentation

c) Session

d) Transport

Correct Answer: b) Presentation

Options explanation:

• a) Network – ❌ Handles addressing and packet forwarding, not encryption.

• b) Presentation – ✅ Correct. Responsible for data translation, compression, and


encryption.
• c) Session – ❌ Manages sessions or connections but doesn’t encrypt data.

• d) Transport – ❌ Provides end-to-end communication but not encryption.

37. Which type of IP address is used for private networks?

a) 10.x.x.x

b) 172.16.x.x – 172.31.x.x

c) 192.168.x.x

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) 10.x.x.x – ✅ One of the private IP ranges (10.0.0.0 – 10.255.255.255).

• b) 172.16.x.x – 172.31.x.x – ✅ Another private range (172.16.0.0 – 172.31.255.255).

• c) 192.168.x.x – ✅ Widely used private range (192.168.0.0 – 192.168.255.255).

• d) All of the above – ✅ Correct. All three are reserved for private networks.

38. What is ARP used for?

a) Convert MAC to IP

b) Convert IP to MAC

c) Routing packets

d) DNS lookup

Correct Answer: b) Convert IP to MAC

Options explanation:

• a) Convert MAC to IP – ❌ ❌ Incorrect; ARP resolves IP addresses to MAC addresses,


not the reverse.

• b) Convert IP to MAC – ✅ Correct. ARP (Address Resolution Protocol) finds the


hardware address (MAC) for a given IP address.
• c) Routing packets – ❌ Incorrect; routing is handled by the network layer, not ARP.

• d) DNS lookup – ❌ ❌ Incorrect; DNS resolves domain names to IP addresses.

39. Which port is default for HTTPS?

a) 80

b) 443

c) 21

d) 22

Correct Answer: b) 443

Options explanation:

• a) 80 – ❌ Default for HTTP (non-secure).

• b) 443 – ✅ Correct. HTTPS uses SSL/TLS to encrypt communications over this port.

• c) 21 – ❌ ❌ Default port for FTP.

• d) 22 – ❌ ❌ Default port for SSH.

40. Which port is default for FTP?

a) 21

b) 22

c) 23

d) 25

Correct Answer: a) 21

Options explanation:

• a) 21 – ✅ Correct. FTP (File Transfer Protocol) uses this port for control commands.

• b) 22 – ❌ ❌ Default for SSH, not FTP.

• c) 23 – ❌ ❌ Default for Telnet.


• d) 25 – ❌ ❌ Default for SMTP (email).

41. Which command is used to check active network connections in Linux?

a) ping

b) netstat

c) traceroute

d) nslookup

Correct Answer: b) netstat

Options explanation:

• a) ping – ❌ Sends ICMP packets to test network connectivity, but doesn’t show active
connections.

• b) netstat – ✅ Correct. Displays current network connections, listening ports, routing


tables, etc.

• c) traceroute – ❌ Shows the path packets take to a destination but doesn’t show active
connections.

• d) nslookup – ❌ Used to query DNS information but not for active connections.

42. Which of these is a hashing algorithm?

a) MD5

b) SHA-1

c) SHA-256

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) MD5 – ✅ Widely used but outdated cryptographic hash algorithm that produces a 128-
bit hash.

• b) SHA-1 – ✅ Secure Hash Algorithm 1, produces 160-bit hash; considered weak now.
• c) SHA-256 – ✅ Part of SHA-2 family, produces a 256-bit hash; widely used for secure
hashing.

• d) All of the above – ✅ Correct. All are hashing algorithms.

43. Which is true about HTTPS?

a) Encrypts data

b) Runs on port 80

c) Uses TLS/SSL

d) a & c

Correct Answer: d) a & c

Options explanation:

• a) Encrypts data – ✅ HTTPS encrypts communication between client and server.

• b) Runs on port 80 – ❌ ❌ Incorrect. HTTPS uses port 443, while port 80 is for HTTP.

• c) Uses TLS/SSL – ✅ Correct. HTTPS relies on SSL/TLS protocols for encryption.

• d) a & c – ✅ Correct. Both encryption and use of TLS/SSL define HTTPS.

44. What is the main purpose of caching?

a) Speed up repeated access

b) Compress data

c) Backup data

d) Secure data

Correct Answer: a) Speed up repeated access

Options explanation:

• a) Speed up repeated access – ✅ Correct. Caching stores frequently used data to reduce
access times.

• b) Compress data – ❌ ❌ Compression reduces storage size but is not the primary goal of
caching.
• c) Backup data – ❌ ❌ Caching is not for data backup but for fast access.

• d) Secure data – ❌ ❌ Caching doesn’t inherently secure data.

45. Which of these is a NoSQL database type?

a) Key-value

b) Document

c) Columnar

d) Graph

e) All of the above

Correct Answer: e) All of the above

Options explanation:

• a) Key-value – ✅ Stores data in key-value pairs (e.g., Redis).

• b) Document – ✅ Stores structured documents like JSON (e.g., MongoDB).

• c) Columnar – ✅ Optimized for analytics; stores data by columns (e.g., Cassandra).

• d) Graph – ✅ Represents relationships between data as graphs (e.g., Neo4j).

• e) All of the above – ✅ Correct. All are valid NoSQL database types.

46. Which of the following is true about REST API?

a) Stateless

b) Uses HTTP methods

c) Can return JSON/XML

d) All of the above

Correct Answer: d) All of the above

Options explanation:
• a) Stateless – ✅ Each request from client to server must contain all necessary information.

• b) Uses HTTP methods – ✅ REST APIs commonly use methods like GET, POST, PUT,
DELETE.

• c) Can return JSON/XML – ✅ REST APIs can respond in various formats like JSON,
XML, etc.

• d) All of the above – ✅ Correct. These are defining features of RESTful APIs.

47. What does SQL injection target?

a) Data loss

b) Unauthorized actions via malicious SQL

c) UI errors

d) Memory leak

Correct Answer: b) Unauthorized actions via malicious SQL

Options explanation:

• a) Data loss – ❌ ❌ Indirect consequence but not the main target.

• b) Unauthorized actions via malicious SQL – ✅ Correct. Attackers inject malicious SQL
statements to manipulate the database.

• c) UI errors – ❌ ❌ SQL injection targets databases, not user interfaces.

• d) Memory leak – ❌ ❌ Memory issues are unrelated to SQL injection.

48. Which of the following is true about Big-O notation?

a) Measures time complexity

b) Measures space complexity

c) Both a & b

d) None

Correct Answer: c) Both a & b

Options explanation:
• a) Measures time complexity – ✅ Correct. It describes how runtime scales with input
size.

• b) Measures space complexity – ✅ Correct. It can also describe how memory usage
scales with input size.

• c) Both a & b – ✅ Correct. Big-O notation applies to both time and space complexity.

• d) None – ❌ ❌ Incorrect. Big-O is widely used to analyze algorithms.

49. Which of these is true about BFS vs DFS?

a) BFS uses queue

b) DFS uses stack/recursion

c) BFS finds shortest path in unweighted graph

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) BFS uses queue – ✅ Correct. BFS explores nodes level by level using a queue.

• b) DFS uses stack/recursion – ✅ Correct. DFS dives deep into a path using recursion or a
stack.

• c) BFS finds shortest path in unweighted graph – ✅ Correct. BFS finds the shortest path
in graphs where all edges have equal weight.

• d) All of the above – ✅ Correct. All statements are true.

50. Which of these is NOT a type of database join?

a) INNER

b) OUTER

c) CROSS

d) LINEAR
Correct Answer: d) LINEAR

Options explanation:

• a) INNER – ✅ Joins only matching rows from both tables.

• b) OUTER – ✅ Includes matching rows and unmatched rows from one or both tables
(LEFT, RIGHT, FULL OUTER).

• c) CROSS – ✅ Produces the Cartesian product of two tables.

• d) LINEAR – ❌ ❌ Not a recognized type of database join.

51. Which of these is a TCP/IP protocol?

a) FTP

b) SMTP

c) HTTP

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) FTP (File Transfer Protocol) – ✅ Uses TCP to transfer files between client and server.

• b) SMTP (Simple Mail Transfer Protocol) – ✅ Uses TCP to send and receive emails.

• c) HTTP (HyperText Transfer Protocol) – ✅ Uses TCP to transmit web content.

• d) All of the above – ✅ Correct. All these protocols are built on TCP/IP.

52. Which HTTP method is safe (does not modify data)?

a) GET

b) POST

c) PUT

d) DELETE
Correct Answer: a) GET

Options explanation:

• a) GET – ✅ Correct. Retrieves data without changing server state.

• b) POST – ❌ Sends data to the server, which can modify resources.

• c) PUT – ❌ Updates or creates resources, modifying data.

• d) DELETE – ❌ Deletes resources, changing server state.

53. What is a primary key?

a) Unique identifier for a table row

b) Can be NULL

c) Not unique

d) Optional

Correct Answer: a) Unique identifier for a table row

Options explanation:

• a) Unique identifier for a table row – ✅ Correct. Ensures each row is distinct.

• b) Can be NULL – ❌ ❌ Incorrect. Primary keys cannot be NULL.

• c) Not unique – ❌ ❌ Incorrect. Uniqueness is essential for primary keys.

• d) Optional – ❌ ❌ Incorrect. Every table should have a primary key.

54. What is foreign key?

a) Refers to primary key in same table

b) Refers to primary key in another table

c) Unique in table

d) Not used in relational DB

Correct Answer: b) Refers to primary key in another table


Options explanation:

• a) Refers to primary key in same table – ❌ ❌ Incorrect. That’s called a self-referencing


key in some cases.

• b) Refers to primary key in another table – ✅ Correct. Used to enforce relationships


between tables.

• c) Unique in table – ❌ ❌ Incorrect. Foreign keys don’t have to be unique.

• d) Not used in relational DB – ❌ ❌ Incorrect. Foreign keys are fundamental in


relational databases.

55. Which CSS property controls element visibility without removing it from layout?

a) display: none

b) visibility: hidden

c) opacity: 0

d) float: none

Correct Answer: b) visibility: hidden

Options explanation:

• a) display: none – ❌ ❌ Removes the element from the layout entirely.

• b) visibility: hidden – ✅ Correct. Hides the element but keeps its space in the layout.

• c) opacity: 0 – ❌ ❌ Makes the element invisible but still clickable and interactive.

• d) float: none – ❌ ❌ Controls alignment, not visibility.

56. Which CSS unit is relative to parent font size?

a) px

b) em

c) pt

d) %

Correct Answer: b) em
Options explanation:

• a) px – ❌ ❌ Absolute unit; independent of parent font size.

• b) em – ✅ Correct. Relative to the font size of the parent element.

• c) pt – ❌ ❌ A print unit, unrelated to parent size in web layout.

• d) % – ❌ ❌ Often used for width/height, but not specifically tied to font size like em.

57. Which JavaScript function converts JSON string to object?

a) JSON.stringify()

b) JSON.parse()

c) JSON.objectify()

d) JSON.toObject()

Correct Answer: b) JSON.parse()

Options explanation:

• a) JSON.stringify() – ❌ ❌ Converts an object to a JSON string.

• b) JSON.parse() – ✅ Correct. Parses JSON strings into JavaScript objects.

• c) JSON.objectify() – ❌ ❌ Invalid function.

• d) JSON.toObject() – ❌ ❌ Invalid function.

58. Which JS keyword defines a constant variable?

a) var

b) let

c) const

d) static

Correct Answer: c) const

Options explanation:
• a) var – ❌ ❌ Defines a variable with function-scoped behavior.

• b) let – ❌ ❌ Defines a block-scoped variable, but not constant.

• c) const – ✅ Correct. Defines a block-scoped constant that cannot be reassigned.

• d) static – ❌ ❌ Not used to define variables in JavaScript.

59. Which of these is true about “this” keyword in JavaScript?

a) Refers to current object

b) Always global

c) Refers to class (Java style)

d) None

Correct Answer: a) Refers to current object

Options explanation:

• a) Refers to current object – ✅ Correct. In object context, this refers to the object calling
the method.

• b) Always global – ❌ ❌ Incorrect. In strict mode, this can be undefined or scoped


differently.

• c) Refers to class (Java style) – ❌ ❌ Incorrect. JavaScript’s this differs from Java’s
class-based behavior.

• d) None – ❌ ❌ Incorrect. One option is valid.

60. Which JS method delays execution of code asynchronously?

a) setTimeout()

b) setInterval()

c) Promise

d) fetch

Correct Answer: a) setTimeout()

Options explanation:
• a) setTimeout() – ✅ Correct. Delays execution of code after a specified time interval.

• b) setInterval() – ❌ ❌ Repeats execution at intervals but doesn’t just delay once.

• c) Promise – ❌ ❌ Handles eventual completion but doesn’t delay execution itself.

• d) fetch – ❌ ❌ Makes network requests asynchronously but is not designed to delay code
execution.

61. Which of these is a preemptive CPU scheduling algorithm?

a) FCFS

b) SJF (non-preemptive)

c) Round Robin

d) None

Correct Answer: c) Round Robin

Options explanation:

• a) FCFS (First Come, First Served) – ❌ ❌ Non-preemptive. Once a process starts


executing, it runs until completion.

• b) SJF (non-preemptive) – ❌ ❌ As stated, it’s non-preemptive and selects the shortest


job but doesn’t interrupt running processes.

• c) Round Robin – ✅ Correct. Preemptive algorithm where each process gets a time slice
and is interrupted to give CPU time to others.

• d) None – ❌ ❌ Incorrect, as Round Robin is preemptive.

62. Which of the following is true about virtual memory?

a) Allows programs to use more memory than physically available

b) Slower than physical memory access

c) Managed by OS

d) All of the above

Correct Answer: d) All of the above


Options explanation:

• a) Allows programs to use more memory than physically available – ✅ Virtual memory
abstracts physical memory using disk space to simulate larger memory.

• b) Slower than physical memory access – ✅ Accessing virtual memory involves paging,
which is slower than RAM access.

• c) Managed by OS – ✅ The operating system handles paging and swapping between


RAM and disk.

• d) All of the above – ✅ Correct. All these characteristics apply to virtual memory.

63. What is a race condition?

a) Program runs faster than expected

b) Two threads/processes access shared data concurrently and result depends on order

c) Infinite loop

d) None

Correct Answer: b) Two threads/processes access shared data concurrently and result depends
on order

Options explanation:

• a) Program runs faster than expected – ❌ ❌ Incorrect. Race conditions are about
concurrency issues, not speed.

• b) Two threads/processes access shared data concurrently and result depends on order
– ✅ Correct. Race conditions happen when timing and execution order cause unpredictable
behavior.

• c) Infinite loop – ❌ ❌ Incorrect. Infinite loops are unrelated.

• d) None – ❌ ❌ Incorrect.

64. What is deadlock in OS?

a) CPU running too fast

b) Two or more processes waiting indefinitely for resources held by each other

c) Memory overflow
d) None

Correct Answer: b) Two or more processes waiting indefinitely for resources held by each
other

Options explanation:

• a) CPU running too fast – ❌ ❌ Incorrect. Deadlock is not about speed.

• b) Two or more processes waiting indefinitely for resources held by each other – ✅
Correct. Deadlock occurs when processes wait forever because each holds resources the
others need.

• c) Memory overflow – ❌ ❌ Incorrect. Memory overflow is a separate issue.

• d) None – ❌ ❌ Incorrect.

65. Which synchronization primitive prevents concurrent access to shared resources?

a) Semaphore

b) Mutex

c) Lock

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Semaphore – ✅ Controls access by multiple processes using counters.

• b) Mutex (Mutual Exclusion) – ✅ Allows only one thread at a time to access shared data.

• c) Lock – ✅ A general mechanism to block access until conditions are met.

• d) All of the above – ✅ Correct. All of these help synchronize access to shared resources.

66. Which of these is a distributed version control system?

a) SVN

b) Git

c) CVS
d) RCS

Correct Answer: b) Git

Options explanation:

• a) SVN (Subversion) – ❌ Centralized version control.

• b) Git – ✅ Distributed version control system where every user has a full copy of the
repository.

• c) CVS (Concurrent Versions System) – ❌ Centralized version control system.

• d) RCS (Revision Control System) – ❌ Works locally and isn’t distributed.

67. Which type of database normalization removes transitive dependency?

a) 1NF

b) 2NF

c) 3NF

d) BCNF

Correct Answer: c) 3NF

Options explanation:

• a) 1NF (First Normal Form) – ❌ Removes repeating groups but not transitive
dependencies.

• b) 2NF (Second Normal Form) – ❌ Removes partial dependencies but not transitive
dependencies.

• c) 3NF (Third Normal Form) – ✅ Removes transitive dependencies by ensuring that non-
primary key attributes depend only on the primary key.

• d) BCNF (Boyce-Codd Normal Form) – ❌ Even stricter than 3NF but not specifically
about transitive dependencies.

68. Which of these SQL commands cannot be rolled back?

a) INSERT

b) DELETE
c) TRUNCATE

d) UPDATE

Correct Answer: c) TRUNCATE

Options explanation:

• a) INSERT – ✅ Can be rolled back as part of a transaction.

• b) DELETE – ✅ Can be rolled back if within a transaction.

• c) TRUNCATE – ❌ ❌ Cannot be rolled back in most database systems because it


quickly removes all records without logging individual row deletions.

• d) UPDATE – ✅ Can be rolled back if transaction control is used.

69. Which data structure is used in recursive function calls?

a) Queue

b) Stack

c) Heap

d) Linked List

Correct Answer: b) Stack

Options explanation:

• a) Queue – ❌ ❌ Not used to keep track of function calls.

• b) Stack – ✅ Correct. Recursive calls are tracked using a call stack where each function’s
state is stored.

• c) Heap – ❌ ❌ Used for dynamic memory allocation, not for tracking function calls.

• d) Linked List – ❌ ❌ Not used by recursion inherently.

70. Which of the following is true about HTTP/1.1 Keep-Alive?

a) Opens new connection per request


b) Reuses the same TCP connection for multiple requests

c) Deprecated feature

d) None

Correct Answer: b) Reuses the same TCP connection for multiple requests

Options explanation:

• a) Opens new connection per request – ❌ ❌ Incorrect. Keep-Alive avoids opening new
connections repeatedly.

• b) Reuses the same TCP connection for multiple requests – ✅ Correct. Improves
efficiency by keeping the connection open across requests.

• c) Deprecated feature – ❌ ❌ Incorrect. It’s still supported to enhance performance.

• d) None – ❌ ❌ Incorrect because option b is valid.

71. Which of the following is true about HTTPS?

a) Encrypts data

b) Runs on port 443

c) Uses TLS/SSL

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Encrypts data – ✅ HTTPS encrypts data between the client and the server to prevent
eavesdropping.

• b) Runs on port 443 – ✅ HTTPS typically operates over TCP port 443.

• c) Uses TLS/SSL – ✅ HTTPS uses TLS (or formerly SSL) protocols to provide secure
communication.

• d) All of the above – ✅ Correct. All these statements describe HTTPS.


72. What is a pointer in C/C++?

a) Variable that stores data directly

b) Variable that stores address of another variable

c) Constant

d) None

Correct Answer: b) Variable that stores address of another variable

Options explanation:

• a) Variable that stores data directly – ❌ ❌ Incorrect. A normal variable holds data, but
a pointer holds an address.

• b) Variable that stores address of another variable – ✅ Correct. Pointers reference


memory locations rather than storing actual data.

• c) Constant – ❌ ❌ Incorrect. Pointers are not constants; they can be changed to point
elsewhere.

• d) None – ❌ ❌ Incorrect.

73. Which of these is a logical error?

a) Division by zero

b) Using wrong formula that produces incorrect results

c) Syntax mistake

d) None

Correct Answer: b) Using wrong formula that produces incorrect results

Options explanation:

• a) Division by zero – ❌ ❌ This is a runtime error; it crashes the program during


execution.

• b) Using wrong formula that produces incorrect results – ✅ Correct. Logical errors
happen when the program runs but produces incorrect results.

• c) Syntax mistake – ❌ ❌ This is a compiler error that prevents code from compiling.
• d) None – ❌ ❌ Incorrect.

74. Which of these is a compiler error?

a) Syntax mistake

b) Logical mistake

c) Runtime mistake

d) None

Correct Answer: a) Syntax mistake

Options explanation:

• a) Syntax mistake – ✅ Correct. A compiler error occurs when the code violates language
rules.

• b) Logical mistake – ❌ ❌ Incorrect. Logical errors happen at runtime or produce wrong


results.

• c) Runtime mistake – ❌ ❌ Incorrect. Runtime errors happen when the program


executes.

• d) None – ❌ ❌ Incorrect.

75. Which of the following is true about Agile methodology?

a) Fixed requirements throughout

b) Frequent delivery of small increments

c) Heavy upfront documentation

d) No customer feedback

Correct Answer: b) Frequent delivery of small increments

Options explanation:

• a) Fixed requirements throughout – ❌ ❌ Incorrect. Agile welcomes changing


requirements.

• b) Frequent delivery of small increments – ✅ Correct. Agile focuses on iterative


development and continuous delivery.
• c) Heavy upfront documentation – ❌ ❌ Incorrect. Agile values working software over
comprehensive documentation.

• d) No customer feedback – ❌ ❌ Incorrect. Agile encourages constant customer


involvement.

76. Which is true about DevOps practice of Continuous Integration (CI)?

a) Frequent merging of code from multiple developers

b) Immediate deployment to production

c) Writing unit tests only

d) None

Correct Answer: a) Frequent merging of code from multiple developers

Options explanation:

• a) Frequent merging of code from multiple developers – ✅ Correct. CI integrates code


regularly to detect issues early.

• b) Immediate deployment to production – ❌ ❌ Incorrect. CI focuses on integrating


code, while CD handles deployment.

• c) Writing unit tests only – ❌ ❌ Incorrect. CI includes automated testing but is not
limited to unit tests.

• d) None – ❌ ❌ Incorrect.

77. Which of these is true about Microservices architecture?

a) Monolithic codebase

b) Each service is independent and deployable

c) Single database for all services

d) None

Correct Answer: b) Each service is independent and deployable

Options explanation:
• a) Monolithic codebase – ❌ ❌ Incorrect. Microservices break applications into separate,
independently deployable units.

• b) Each service is independent and deployable – ✅ Correct. Microservices architecture


enables modular, scalable development.

• c) Single database for all services – ❌ ❌ Incorrect. Microservices often use separate
databases for each service.

• d) None – ❌ ❌ Incorrect.

78. Which of these scheduling algorithms minimizes average waiting time if all processes arrive at
same time?

a) FCFS

b) SJF (non-preemptive)

c) Round Robin

d) Priority

Correct Answer: b) SJF (non-preemptive)

Options explanation:

• a) FCFS – ❌ ❌ Processes are handled in order of arrival, not optimized for waiting time.

• b) SJF (non-preemptive) – ✅ Correct. Shortest Job First minimizes waiting time when all
processes are available from the start.

• c) Round Robin – ❌ ❌ Provides fairness, not optimized for waiting time.

• d) Priority – ❌ ❌ May favor certain processes but doesn’t guarantee minimum waiting
time.

79. Which of these is a security vulnerability?

a) SQL injection

b) Cross-site scripting (XSS)

c) Buffer overflow

d) All of the above


Correct Answer: d) All of the above

Options explanation:

• a) SQL injection – ✅ Vulnerability where attackers insert malicious SQL to manipulate a


database.

• b) Cross-site scripting (XSS) – ✅ Allows attackers to inject scripts into webpages viewed
by others.

• c) Buffer overflow – ✅ Happens when more data is written than a buffer can hold,
potentially allowing code execution.

• d) All of the above – ✅ Correct. All listed options are common security vulnerabilities.

80. Which of these protocols is used for email sending?

a) SMTP

b) POP3

c) IMAP

d) HTTP

Options explanation:

• a) SMTP (Simple Mail Transfer Protocol) – ✅ Correct. SMTP is used to send emails
from client to server or between servers.

• b) POP3 (Post Office Protocol version 3) – ❌ ❌ Used to retrieve emails, not send.

• c) IMAP (Internet Message Access Protocol) – ❌ ❌ Also used to retrieve and manage
emails.

• d) HTTP (HyperText Transfer Protocol) – ❌ ❌ Used for web browsing, not email
transfer.

81. Which layer of OSI model is responsible for end-to-end delivery?

a) Transport

b) Network

c) Data Link

d) Application
Options explanation:

• a) Transport – ✅ Correct. The Transport layer (Layer 4) ensures reliable, ordered, and
error-checked delivery between end systems.

• b) Network – ❌ ❌ Handles routing and forwarding of data but doesn’t ensure delivery
between end systems.

• c) Data Link – ❌ ❌ Deals with node-to-node data transfer, not end-to-end


communication.

• d) Application – ❌ ❌ Provides services directly to applications but doesn’t manage data


transfer reliability.

82. Which of these is an example of NoSQL key-value database?

a) Redis

b) MongoDB

c) Cassandra

d) MySQL

Correct Answer: a) Redis

Options explanation:

• a) Redis – ✅ Correct. Redis is a popular key-value store used for caching, sessions, etc.

• b) MongoDB – ❌ ❌ Document-oriented NoSQL database.

• c) Cassandra – ❌ ❌ Columnar NoSQL database optimized for large datasets.

• d) MySQL – ❌ ❌ Relational database, not a NoSQL key-value store

83. Which of the following is true about ACID properties in databases?

a) Atomicity ensures all-or-nothing execution

b) Consistency ensures database moves from one valid state to another

c) Isolation ensures transactions don’t interfere

d) Durability ensures committed changes survive failures


e) All of the above

Correct Answer: e) All of the above

Options explanation:

• a) Atomicity ensures all-or-nothing execution – ✅ Transactions either fully succeed or


fully fail.

• b) Consistency ensures database moves from one valid state to another – ✅ Data
integrity rules are preserved.

• c) Isolation ensures transactions don’t interfere – ✅ Transactions execute independently


to avoid data corruption.

• d) Durability ensures committed changes survive failures – ✅ Once a transaction is


committed, it persists even if a system crash happens.

• e) All of the above – ✅ Correct. These are all core principles of ACID.

84. Which of these cloud services is PaaS (Platform as a Service)?

a) AWS Lambda

b) Heroku

c) Digital Ocean Droplets

d) None

Correct Answer: b) Heroku

Options explanation:

• a) AWS Lambda – ❌ ❌ Serverless compute (FaaS – Function as a Service), not PaaS.

• b) Heroku – ✅ Correct. Heroku provides a platform for deploying applications without


managing underlying infrastructure.

• c) Digital Ocean Droplets – ❌ ❌ Infrastructure as a Service (IaaS), gives virtual servers.

• d) None – ❌ ❌ Incorrect because Heroku is a PaaS.

85. Which HTTP method is idempotent?


a) GET

b) PUT

c) DELETE

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) GET – ✅ Retrieves data without changing it; repeated requests are safe.

• b) PUT – ✅ Updates or creates a resource at a fixed URL; repeated requests have the same
result.

• c) DELETE – ✅ Removes a resource; repeated requests result in the same state.

• d) All of the above – ✅ Correct. All these methods are idempotent by definition.

86. Which of the following is true about JSON?

a) Data is stored in key-value pairs

b) Supports arrays

c) Strings must use double quotes

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Data is stored in key-value pairs – ✅ JSON stores data as objects with keys and
associated values.

• b) Supports arrays – ✅ JSON supports arrays of values or objects.

• c) Strings must use double quotes – ✅ Correct. JSON syntax requires double quotes for
keys and string values.

• d) All of the above – ✅ Correct. All statements describe JSON format accurately.

87. What is CORS in web development?


a) Cross-Origin Resource Sharing

b) Cross-Origin Request Security

c) Cross-Origin Resource Server

d) None

Correct Answer: a) Cross-Origin Resource Sharing

Options explanation:

• a) Cross-Origin Resource Sharing – ✅ Correct. CORS is a security feature that controls


requests from one origin to another.

• b) Cross-Origin Request Security – ❌ ❌ Incorrect. This is not the official term.

• c) Cross-Origin Resource Server – ❌ ❌ Incorrect. It’s not a server, but a mechanism.

• d) None – ❌ ❌ Incorrect because option a is valid.

88. Which of the following is NOT true about TCP?

a) Reliable

b) Connection-oriented

c) Message boundaries preserved

d) Error-checked

Correct Answer: c) Message boundaries preserved

Options explanation:

• a) Reliable – ✅ TCP guarantees delivery without loss or corruption.

• b) Connection-oriented – ✅ TCP establishes a connection before data transfer.

• c) Message boundaries preserved – ❌ ❌ Incorrect. TCP treats data as a stream, so


message boundaries aren’t preserved like in UDP.

• d) Error-checked – ✅ TCP uses checksums and acknowledgments to detect and correct


errors.

89. Which of the following is NOT true about UDP?


a) Connectionless

b) Reliable

c) Faster than TCP

d) Suitable for streaming

Correct Answer: b) Reliable

Options explanation:

• a) Connectionless – ✅ UDP sends data without establishing a connection.

• b) Reliable – ❌ ❌ Incorrect. UDP doesn’t guarantee delivery or order.

• c) Faster than TCP – ✅ UDP is faster because it skips connection setup and error
correction.

• d) Suitable for streaming – ✅ Used in real-time applications where speed matters more
than reliability.

90. Which of these is a front-end framework?

a) Angular

b) Django

c) Spring

d) Node.js

Correct Answer: a) Angular

Options explanation:

• a) Angular – ✅ Correct. Angular is a front-end framework used for building interactive


web apps.

• b) Django – ❌ ❌ A backend framework based on Python.

• c) Spring – ❌ ❌ A backend framework based on Java.

• d) Node.js – ❌ ❌ A server-side runtime environment using JavaScript.

91. Which of these is a back-end framework?


a) Flask

b) React

c) Vue

d) Bootstrap

Correct Answer: a) Flask

Options explanation:

• a) Flask – ✅ Correct. Flask is a Python-based back-end framework used to build web


applications and APIs.

• b) React – ❌ ❌ Front-end library used for building UI components.

• c) Vue – ❌ ❌ Front-end framework used for creating interactive web interfaces.

• d) Bootstrap – ❌ ❌ CSS framework used for styling front-end layouts.

92. Which of these HTTP status codes indicates “Moved Permanently”?

a) 200

b) 301

c) 302

d) 404

Correct Answer: b) 301

Options explanation:

• a) 200 – ❌ ❌ Success response; request completed successfully.

• b) 301 – ✅ Correct. Indicates that the resource has been moved to a new URL
permanently.

• c) 302 – ❌ ❌ Temporary redirect; the resource is moved temporarily.

• d) 404 – ❌ ❌ Resource not found.

93. Which of these algorithms is used for shortest path in weighted graph?
a) Dijkstra

b) BFS

c) DFS

d) Prim

Correct Answer: a) Dijkstra

Options explanation:

• a) Dijkstra – ✅ Correct. Dijkstra’s algorithm finds the shortest path between nodes in a
weighted graph without negative edges.

• b) BFS – ❌ ❌ Suitable for unweighted graphs; doesn’t consider edge weights.

• c) DFS – ❌ ❌ Depth-first traversal; doesn’t guarantee shortest path.

• d) Prim – ❌ ❌ Used for Minimum Spanning Tree, not shortest path.

94. Which of these is true about Stack memory?

a) Stores local variables and function calls

b) Fast access

c) Grows downward (language dependent)

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Stores local variables and function calls – ✅ Stack stores temporary data like function
call states and local variables.

• b) Fast access – ✅ Accessing stack memory is faster due to its structured allocation.

• c) Grows downward (language dependent) – ✅ Many systems allocate stack from higher
memory addresses downward.

• d) All of the above – ✅ Correct, all statements apply.

95. Which of these is true about Heap memory?


a) Used for dynamic allocation

b) Shared across threads

c) Slower than stack

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Used for dynamic allocation – ✅ Heap memory is used when objects or variables are
created dynamically at runtime.

• b) Shared across threads – ✅ Heap memory can be shared, but care must be taken to
synchronize access.

• c) Slower than stack – ✅ Heap allocations are slower due to fragmentation and
management overhead.

• d) All of the above – ✅ Correct.

96. Which of these is NOT a primitive type in Java?

a) int

b) float

c) String

d) boolean

Correct Answer: c) String

Options explanation:

• a) int – ✅ Primitive type for storing integers.

• b) float – ✅ Primitive type for storing floating-point numbers.

• c) String – ❌ ❌ Not primitive; it's a class representing sequences of characters.

• d) boolean – ✅ Primitive type representing true/false values.

97. Which of these is true about MVC architecture?


a) Model handles data logic

b) View handles display

c) Controller handles input logic

d) All of the above

Correct Answer: d) All of the above

Options explanation:

• a) Model handles data logic – ✅ Manages data, state, and business logic.

• b) View handles display – ✅ Responsible for presenting data to users.

• c) Controller handles input logic – ✅ Accepts user input and updates model or view
accordingly.

• d) All of the above – ✅ Correct, all components have defined roles.

98. Which of the following is NOT a valid loop in Java?

a) for

b) while

c) foreach

d) repeat-until

Correct Answer: d) repeat-until

Options explanation:

• a) for – ✅ A loop structure that iterates a set number of times.

• b) while – ✅ Executes as long as a condition is true.

• c) foreach – ✅ Enhanced for-loop for iterating over arrays or collections.

• d) repeat-until – ❌ ❌ Not a valid Java loop structure.

99. Which of these Git commands stages changes for commit?

a) git add
b) git commit

c) git push

d) git merge

Correct Answer: a) git add

Options explanation:

• a) git add – ✅ Correct. It adds changes to the staging area before committing.

• b) git commit – ❌ ❌ Saves staged changes as a new commit but doesn’t stage them
itself.

• c) git push – ❌ ❌ Uploads commits to a remote repository.

• d) git merge – ❌ ❌ Combines branches, not for staging.

100. Which of the following is true about REST API idempotency?

a) Multiple identical requests have same effect as a single request

b) POST is always idempotent

c) GET modifies server state

d) None

Correct Answer: a) Multiple identical requests have same effect as a single request

Options explanation:

• a) Multiple identical requests have same effect as a single request – ✅ Correct.


Idempotency means making repeated requests won’t alter the outcome beyond the initial
one.

• b) POST is always idempotent – ❌ ❌ Incorrect. POST requests often change state and
are not idempotent.

• c) GET modifies server state – ❌ ❌ Incorrect. GET requests are meant to be safe and
shouldn’t change state.

• d) None – ❌ ❌ Incorrect because option a is correct.

You might also like