Connection restored!
Notification Center
Loading notifications...
Loading announcements...
INCOMING 1v1 DUEL! 10:00
@friend challenged you!
Topic · Room #HQ-0000
Accept & Join
Mention Scholar ↑↓ Enter / Click
Last time you were studying on Page 2.
STUDY & LEARNING DECK

Computer PYQs

Showing 25 of 4040 total questions (Latest Added First).

Timed Quiz
Newest Classic 25 Qs
No Questions Match Your Filter

Try clearing filters or unchecking "Saved" / "Hide".

Question 1976 NEW
Most Important EASY
Which data structure is used by a computer's CPU and OS to manage nested function calls, recursion, and the "Undo" (`Ctrl + Z`) feature in text editors?
नेस्टेड फंक्शन कॉल्स, रिकर्शन और टेक्स्ट एडिटर्स में "अनडू" (`Ctrl + Z`) फीचर को मैनेज करने के लिए किस डेटा स्ट्रक्चर का उपयोग किया जाता है?
A
Queue
क्यू
B
Stack
स्टैक
Correct
C
Graph
ग्राफ
D
Binary Tree
बाइनरी ट्री
Solution Breakdown:
-> Because the most recent action must be undone first (and the most recent function call must return first), the LIFO Stack is the ideal structure. -> Hence, Option (B) is the correct answer.
-> सबसे हाल के कार्य को सबसे पहले वापस लेने (Undo) के लिए LIFO स्टैक का उपयोग होता है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1977 NEW
Most Important MEDIUM
In a Binary Search Tree (BST), which traversal order visits all nodes in ASCENDING (sorted) order?
बाइनरी सर्च ट्री (BST) में कौन सा ट्रैवर्सल क्रम सभी नोड्स को आरोही (बढ़ते हुए सॉर्टेड) क्रम में दिखाता है?
A
Preorder Traversal
प्रीऑर्डर ट्रैवर्सल
B
Postorder Traversal
पोस्टऑर्डर ट्रैवर्सल
C
Inorder Traversal
इनऑर्डर ट्रैवर्सल
Correct
D
Random Traversal
रैंडम ट्रैवर्सल
Solution Breakdown:
-> Inorder Traversal visits `Left -> Root -> Right`. Because every left child in a BST is smaller and every right child is larger, Inorder always outputs elements in sorted ascending order. -> Hence, Option (C) is the correct answer.
-> BST में इनऑर्डर ट्रैवर्सल (`Left -> Root -> Right`) हमेशा तत्वों को बढ़ते हुए सॉर्टेड क्रम में देता है। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1978 NEW
Most Important EASY
Which data structure is used internally to implement Breadth-First Search (BFS) on a Graph or Level-Order Traversal on a Tree?
ग्राफ पर BFS या ट्री पर लेवल-ऑर्डर ट्रैवर्सल लागू करने के लिए आंतरिक रूप से किस डेटा स्ट्रक्चर का उपयोग किया जाता है?
A
Stack
स्टैक
B
Queue
क्यू
Correct
C
Hash Table
हैश टेबल
D
Linked List
लिंक्ड लिस्ट
Solution Breakdown:
-> BFS explores all neighbor nodes at the current depth level first using a FIFO Queue, whereas DFS explores as deep as possible using a LIFO Stack. -> Hence, Option (B) is the correct answer.
-> BFS के लिए क्यू (FIFO) और DFS के लिए स्टैक (LIFO) का उपयोग किया जाता है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1979 NEW
Most Important MEDIUM
What is the Time Complexity of Depth-First Search (DFS) and Breadth-First Search (BFS) on a Graph represented using an Adjacency List (where $V$ = vertices and $E$ = edges)?
एडजेसेंसी लिस्ट द्वारा दर्शाए गए ग्राफ पर DFS और BFS की टाइम कॉम्प्लेक्सिटी क्या होती है?
A
$O(V)$
$O(V)$
B
$O(E)$
$O(E)$
C
$O(V + E)$
$O(V + E)$
Correct
D
$O(V \times E)$
$O(V \times E)$
Solution Breakdown:
-> Both DFS (using a Stack/Recursion) and BFS (using a Queue) visit every vertex once and traverse every edge once, giving a linear time complexity of $O(V + E)$. -> Hence, Option (C) is the correct answer.
-> DFS और BFS हर वर्टेक्स और हर एज को एक बार विज़िट करते हैं, इसलिए उनकी टाइम कॉम्प्लेक्सिटी $O(V + E)$ होती है। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1980 NEW
Most Important EASY
What is the Time Complexity of "Binary Search" on a sorted array of `n` elements?
`n` तत्वों के एक सॉर्टेड एरे पर "बाइनरी सर्च" की टाइम कॉम्प्लेक्सिटी क्या होती है?
A
$O(n)$
$O(n)$
B
$O(\log n)$
$O(\log n)$
Correct
C
$O(n^2)$
$O(n^2)$
D
$O(1)$
$O(1)$
Solution Breakdown:
-> Binary Search repeatedly divides the search interval in half, achieving logarithmic $O(\log n)$ time—far faster than Linear Search's $O(n)$. Note: the array MUST be sorted first. -> Hence, Option (B) is the correct answer.
-> बाइनरी सर्च हर चरण में खोज क्षेत्र को आधा कर देता है, जिससे इसकी टाइम कॉम्प्लेक्सिटी $O(\log n)$ होती है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1981 NEW
Most Important MEDIUM
Which sorting algorithm repeatedly finds the smallest element from the unsorted portion of a list and swaps it with the leftmost unsorted element?
कौन सा सॉर्टिंग एल्गोरिदम बार-बार अनसॉर्टेड हिस्से से सबसे छोटा तत्व ढूंढकर उसे सबसे बाईं ओर के अनसॉर्टेड तत्व से स्वैप करता है?
A
Selection Sort
सेलेक्शन सॉर्ट
Correct
B
Merge Sort
मर्ज सॉर्ट
C
Quick Sort
क्विक सॉर्ट
D
Insertion Sort
इंसर्शन सॉर्ट
Solution Breakdown:
-> Selection Sort divides the array into a sorted left part and an unsorted right part, selecting the minimum item in each pass ($O(n^2)$ time complexity). -> Hence, Option (A) is the correct answer.
-> सेलेक्शन सॉर्ट हर चरण में सबसे छोटा तत्व चुनकर उसे बाईं ओर सही स्थान पर रखता है। -> इसलिए विकल्प (A) बिल्कुल सही है।
Question 1982 NEW
Most Important EASY
In a Tree data structure, what is the topmost node (which has no parent) called, and what are the bottom nodes (which have no children) called?
ट्री डेटा स्ट्रक्चर में सबसे ऊपरी नोड (जिसका कोई पैरेंट नहीं होता) को क्या कहते हैं, और सबसे निचले नोड्स (जिनके कोई चाइल्ड नहीं होते) को क्या कहते हैं?
A
Leaf Node, Root Node
लीफ नोड, रूट नोड
B
Root Node, Leaf Nodes
रूट नोड, लीफ नोड्स
Correct
C
Child Node, Parent Node
चाइल्ड नोड, पैरेंट नोड
D
Start Node, End Node
स्टार्ट नोड, एंड नोड
Solution Breakdown:
-> Every tree starts at a single Root Node at the top and ends at Leaf Nodes (external nodes) at the bottom. -> Hence, Option (B) is the correct answer.
-> ट्री के सबसे ऊपरी नोड को 'रूट नोड' और बिना चाइल्ड वाले अंतिम नोड्स को 'लीफ नोड्स' कहा जाता है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1983 NEW
Most Important EASY
A node structure containing `int data; struct node* left; struct node* right;` represents which data structure?
`int data; struct node* left; struct node* right;` वाली नोड संरचना किस डेटा स्ट्रक्चर को दर्शाती है?
A
Queue
क्यू
B
Stack
स्टैक
C
Binary Tree
बाइनरी ट्री
Correct
D
Simple Array
साधारण एरे
Solution Breakdown:
-> A Binary Tree is a hierarchical non-linear data structure where each parent node has at most two children: a `left` child and a `right` child. -> Hence, Option (C) is the correct answer.
-> बाइनरी ट्री एक नॉन-लीनियर डेटा स्ट्रक्चर है जिसमें प्रत्येक नोड के अधिकतम दो चाइल्ड (`left` और `right`) होते हैं। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1984 NEW
Most Important MEDIUM
How many total pointer fields are present across all nodes of a Doubly Linked List containing `5` nodes?
`5` नोड्स वाली एक डबली लिंक्ड लिस्ट के सभी नोड्स में कुल कितने पॉइंटर फील्ड्स होते हैं?
A
5
5
B
8
8
C
10
10
Correct
D
15
15
Solution Breakdown:
-> Each node in a Doubly Linked List contains 3 fields: 1 data field and 2 pointer fields (`prev` and `next`). For 5 nodes, total pointers $= 5 \times 2 = 10$. -> Hence, Option (C) is the correct answer.
-> डबली लिंक्ड लिस्ट के हर नोड में 2 पॉइंटर (`prev` और `next`) होते हैं, इसलिए 5 नोड्स में कुल $5 \times 2 = 10$ पॉइंटर होंगे। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1985 NEW
Most Important MEDIUM
Which of the following statements is INCORRECT regarding Arrays vs. Linked Lists?
एरे और लिंक्ड लिस्ट की तुलना के संबंध में निम्नलिखित में से कौन सा कथन गलत है?
A
Arrays allow fast $O(1)$ random access by index
एरे इंडेक्स द्वारा तेज़ रैंडम एक्सेस की अनुमति देते हैं
B
Linked Lists allow only sequential access
लिंक्ड लिस्ट केवल क्रमिक (सीक्वेंशियल) एक्सेस की अनुमति देती है
C
Linked Lists are slower in insertion/deletion and faster in random element lookup (`get`)
लिंक्ड लिस्ट इंसर्शन/डिलीशन में धीमी और रैंडम लुकअप (`get`) में तेज़ होती है
Correct
D
Linked Lists allocate memory dynamically as new nodes are added
नए नोड्स जुड़ने पर लिंक्ड लिस्ट डायनामिक रूप से मेमोरी आवंटित करती है
Solution Breakdown:
-> Statement (C) is reversed/incorrect: Linked Lists are FASTER at insertion and deletion (just updating pointers), but SLOWER at searching/getting an element by index. -> Hence, Option (C) is the correct answer.
-> लिंक्ड लिस्ट इंसर्शन और डिलीशन में तेज़ होती है, लेकिन किसी तत्व को सीधे खोजने (`get`) में धीमी होती है, इसलिए कथन (C) गलत है। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1986 NEW
Most Important EASY
Arrays, Stacks, Queues, and Linked Lists are classified as:
एरे, स्टैक, क्यू और लिंक्ड लिस्ट को किस श्रेणी में रखा जाता है?
A
Primitive Data Types
प्रिमिटिव डेटा टाइप
B
Non-Primitive Data Structures
नॉन-प्रिमिटिव डेटा स्ट्रक्चर
Correct
C
Hardware Components
हार्डवेयर घटक
D
Operating Systems
ऑपरेटिंग सिस्टम
Solution Breakdown:
-> Basic built-in types (`int`, `char`, `float`, `bool`) are Primitive data types, whereas complex structures built from them (Arrays, Stacks, Queues, Trees) are Non-Primitive data structures. -> Hence, Option (B) is the correct answer.
-> `int`, `char`, `float` प्रिमिटिव हैं, जबकि एरे, स्टैक, क्यू और ट्री नॉन-प्रिमिटिव डेटा स्ट्रक्चर हैं। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1987 NEW
Most Important EASY
What is a "Deque" (Double-Ended Queue)?
"डीक्यू" (डबल-एंडेड क्यू) क्या होता है?
A
A queue that allows insertion and deletion at BOTH ends (Front and Rear)
एक क्यू जिसमें दोनों सिरों (फ्रंट और रियर) से तत्व जोड़े और हटाए जा सकते हैं
Correct
B
A queue that can only hold two elements
केवल दो तत्व रखने वाला क्यू
C
A stack with no top
बिना शीर्ष वाला स्टैक
D
A deleted queue
एक डिलीट किया गया क्यू
Solution Breakdown:
-> A Deque has two special variations: Input-Restricted Deque (insertion at one end only) and Output-Restricted Deque (deletion at one end only). -> Hence, Option (A) is the correct answer.
-> डीक्यू में दोनों सिरों से इनपुट और आउटपुट किया जा सकता है। -> इसलिए विकल्प (A) बिल्कुल सही है।
Question 1988 NEW
Most Important EASY
What condition occurs when a program attempts to remove (`Pop` or `Dequeue`) an element from an already EMPTY Stack or Queue?
जब कोई प्रोग्राम पहले से खाली स्टैक या क्यू से कोई तत्व निकालने की कोशिश करता है, तो कौन सी स्थिति उत्पन्न होती है?
A
Overflow
ओवरफ्लो
B
Underflow
अंडरफ्लो
Correct
C
Deadlock
डेडलॉक
D
Thrashing
थ्रैशिंग
Solution Breakdown:
-> Trying to delete from an empty structure causes Underflow (`front == -1` in a queue), whereas trying to insert into a completely full fixed-size structure causes Overflow. -> Hence, Option (B) is the correct answer.
-> खाली स्टैक/क्यू से तत्व निकालने पर 'अंडरफ्लो' और भरे हुए स्टैक/क्यू में तत्व डालने पर 'ओवरफ्लो' होता है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1989 NEW
Most Important EASY
In a Queue data structure, new elements are inserted at the ________ end and removed from the ________ end.
क्यू डेटा स्ट्रक्चर में नए तत्व ________ सिरे पर जोड़े जाते हैं और ________ सिरे से हटाए जाते हैं।
A
Front, Rear
फ्रंट, रियर
B
Rear, Front
रियर, फ्रंट
Correct
C
Top, Bottom
टॉप, बॉटम
D
Left, Left
लेफ्ट, लेफ्ट
Solution Breakdown:
-> A Queue uses TWO ends: `Rear` (back) for insertion (`Enqueue`) and `Front` for deletion (`Dequeue`), whereas a Stack uses only ONE end (`Top`). -> Hence, Option (B) is the correct answer.
-> क्यू में दो सिरे होते हैं: रियर (जहाँ तत्व जुड़ते हैं) और फ्रंट (जहाँ से तत्व हटाए जाते हैं)। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1990 NEW
Most Important EASY
Which order principle does a "Queue" data structure follow?
"क्यू" (Queue) डेटा स्ट्रक्चर किस क्रम सिद्धांत का पालन करता है?
A
LIFO (Last-In, First-Out)
लीफो
B
FIFO (First-In, First-Out)
फीफो (पहले आओ, पहले जाओ)
Correct
C
FILO (First-In, Last-Out)
फिलो
D
Random Access
रैंडम एक्सेस
Solution Breakdown:
-> Just like a ticket line, the element inserted first into a Queue is always the first element removed—First-In, First-Out (FIFO). -> Hence, Option (B) is the correct answer.
-> क्यू में जो तत्व सबसे पहले डाला जाता है, वही सबसे पहले बाहर निकलता है (FIFO)। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1991 NEW
Most Important EASY
Adding a new element to the top of a Stack is called ________, and removing the top element is called ________.
स्टैक के शीर्ष पर नया तत्व जोड़ना ________ कहलाता है, और शीर्ष तत्व को हटाना ________ कहलाता है।
A
Enqueue, Dequeue
एनक्यू, डीक्यू
B
Insert, Delete
इंसर्ट, डिलीट
C
Push, Pop
पुश, पॉप
Correct
D
Add, Cut
ऐड, कट
Solution Breakdown:
-> `Push` places a new item onto the top of the stack; `Pop` removes and returns the topmost item; `Peek` (or `Top`) views the top item without removing it. -> Hence, Option (C) is the correct answer.
-> स्टैक में तत्व डालने को 'पुश' (Push) और निकालने को 'पॉप' (Pop) कहा जाता है। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1992 NEW
Most Important EASY
Which order principle does a "Stack" data structure follow?
"स्टैक" डेटा स्ट्रक्चर किस क्रम सिद्धांत का पालन करता है?
A
FIFO (First-In, First-Out)
फीफो (पहले आओ, पहले जाओ)
B
LIFO (Last-In, First-Out)
लीफो (अंत में आओ, पहले जाओ)
Correct
C
Random Order
रैंडम क्रम
D
Priority Order
प्राथमिकता क्रम
Solution Breakdown:
-> In a Stack (like a stack of plates), the most recently added element at the TOP is always the first one removed—Last-In, First-Out (LIFO). -> Hence, Option (B) is the correct answer.
-> स्टैक में सबसे ऊपर (अंत में) रखा गया तत्व सबसे पहले निकाला जाता है, जिसे LIFO कहते हैं। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1993 NEW
Most Important EASY
Which of the following is a "Linear" Data Structure?
निम्नलिखित में से कौन सा एक "लीनियर" (रैखिक) डेटा स्ट्रक्चर है?
A
Tree
ट्री
B
Graph
ग्राफ
C
Stack (and Queue
Array / Linked List) / स्टैक (और क्यू / एरे / लिंक्ड लिस्ट)
Correct
D
Heap
हीप
Solution Breakdown:
-> In Linear data structures (Array, Linked List, Stack, Queue), elements are arranged sequentially one after another; Trees and Graphs are Non-Linear data structures. -> Hence, Option (C) is the correct answer.
-> एरे, लिंक्ड लिस्ट, स्टैक और क्यू लीनियर डेटा स्ट्रक्चर हैं, जबकि ट्री और ग्राफ नॉन-लीनियर हैं। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1994 NEW
Most Important EASY
What is a "Data Structure" in computer science?
कंप्यूटर विज्ञान में "डेटा स्ट्रक्चर" क्या होता है?
A
A physical hard disk
एक भौतिक हार्ड डिस्क
B
A specialized way of organizing, storing, and managing data in memory so it can be accessed and modified efficiently
मेमोरी में डेटा को व्यवस्थित, स्टोर और प्रबंधित करने का एक विशेष तरीका ताकि उसे कुशलता से एक्सेस और अपडेट किया जा सके
Correct
C
A type of antivirus
एक प्रकार का एंटीवायरस
D
A network cable
एक नेटवर्क केबल
Solution Breakdown:
-> Choosing the right data structure (Arrays, Linked Lists, Stacks, Queues, Trees, Graphs) plays a vital role in program design and algorithm speed. -> Hence, Option (B) is the correct answer.
-> सही डेटा स्ट्रक्चर का चुनाव प्रोग्राम डिज़ाइन और एल्गोरिदम की गति बढ़ाने में महत्वपूर्ण भूमिका निभाता है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1995 NEW
Most Important EASY
How does C++ view every disk file during File I/O operations?
फाइल I/O ऑपरेशंस के दौरान C++ प्रत्येक डिस्क फाइल को किस रूप में देखता है?
A
As a sequential stream of bytes
बाइट्स की एक क्रमिक स्ट्रीम के रूप में
Correct
B
As a 2D array
एक 2D एरे के रूप में
C
As a binary tree
एक बाइनरी ट्री के रूप में
D
As a stack
एक स्टैक के रूप में
Solution Breakdown:
-> C++ treats files as a sequential stream of bytes using stream classes (`ifstream` for reading, `ofstream` for writing, and `fstream` for both). -> Hence, Option (A) is the correct answer.
-> C++ हर फाइल को बाइट्स की एक क्रमिक स्ट्रीम (Sequential stream of bytes) के रूप में संभालता है। -> इसलिए विकल्प (A) बिल्कुल सही है।
Question 1996 NEW
Most Important MEDIUM
When an object of a Derived (Child) class is created in C++, which constructor is executed FIRST?
C++ में जब किसी डिराइव्ड (चाइल्ड) क्लास का ऑब्जेक्ट बनाया जाता है, तो कौन सा कंस्ट्रक्टर सबसे पहले निष्पादित होता है?
A
Derived class constructor
डिराइव्ड क्लास का कंस्ट्रक्टर
B
Base (Parent) class constructor
बेस (पैरेंट) क्लास का कंस्ट्रक्टर
Correct
C
Destructor
डिस्ट्रक्टर
D
Neither is called
कोई भी कॉल नहीं होता
Solution Breakdown:
-> When instantiating a derived class object, C++ always invokes the Base class constructor first to initialize inherited members, followed by the Derived class constructor. (Destructors run in the exact reverse order). -> Hence, Option (B) is the correct answer.
-> चाइल्ड क्लास का ऑब्जेक्ट बनते समय पहले बेस क्लास का कंस्ट्रक्टर चलता है और उसके बाद चाइल्ड क्लास का कंस्ट्रक्टर। -> इसलिए विकल्प (B) बिल्कुल सही है।
Question 1997 NEW
Most Important MEDIUM
What happens when the following valid C++ code is compiled and executed: `int *ptr = NULL; delete ptr;`?
जब C++ में `int *ptr = NULL; delete ptr;` को कंपाइल और निष्पादित किया जाता है, तो क्या होता है?
A
Compile-time syntax error
कंपाइल-टाइम सिंटैक्स एरर
B
Runtime crash (Segmentation Fault)
रन-टाइम क्रैश
C
Compiles and executes safely without any error
बिना किसी त्रुटि के सुरक्षित रूप से कंपाइल और निष्पादित होता है
Correct
D
Infinite loop
अनंत लूप
Solution Breakdown:
-> The C++ standard explicitly guarantees that calling `delete` on a `NULL` (or `nullptr`) pointer is completely safe and performs no operation. -> Hence, Option (C) is the correct answer.
-> C++ मानक के अनुसार `NULL` पॉइंटर पर `delete` चलाना पूरी तरह सुरक्षित है और इससे कोई त्रुटि नहीं आती। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1998 NEW
Most Important EASY
In C++ Exception Handling, the risky code that might cause an abnormal runtime error is placed inside which block?
C++ एक्सेप्शन हैंडलिंग में, वह संभावित कोड जिसमें रन-टाइम त्रुटि आ सकती है, किस ब्लॉक के अंदर लिखा जाता है?
A
`catch` block
कैच ब्लॉक
B
`throw` block
थ्रो ब्लॉक
C
`try` block
ट्राई ब्लॉक
Correct
D
`error` block
एरर ब्लॉक
Solution Breakdown:
-> In C++, risky code goes inside `try { }`, exceptions are signaled using `throw`, and error recovery code goes inside `catch { }`. -> Hence, Option (C) is the correct answer.
-> संभावित त्रुटि वाला कोड `try` ब्लॉक में लिखा जाता है और उसे संभालने का कोड `catch` ब्लॉक में होता है। -> इसलिए विकल्प (C) बिल्कुल सही है।
Question 1999 NEW
Most Important MEDIUM
What is a key difference between C++'s `new` operator and C's `malloc()` function?
C++ के `new` ऑपरेटर और C के `malloc()` फंक्शन में क्या मुख्य अंतर है?
A
`new` is an operator that calls the object's constructor and returns the exact typed pointer, whereas `malloc()` is a function that does not call constructors and returns a `void*` pointer
`new` एक ऑपरेटर है जो कंस्ट्रक्टर कॉल करता है और सही टाइप का पॉइंटर देता है, जबकि `malloc()` एक फंक्शन है जो कंस्ट्रक्टर कॉल नहीं करता और `void*` पॉइंटर देता है
Correct
B
`malloc()` is faster because it calls destructors
`malloc()` तेज़ है क्योंकि यह डिस्ट्रक्टर कॉल करता है
C
`new` cannot allocate memory on the Heap
`new` हीप पर मेमोरी आवंटित नहीं कर सकता
D
Both require manual typecasting
दोनों में मैनुअल टाइपकास्टिंग ज़रूरी है
Solution Breakdown:
-> Because `new` understands C++ classes, it automatically calculates the required byte size and invokes the constructor; `malloc()` only allocates raw uninitialized bytes. -> Hence, Option (A) is the correct answer.
-> `new` ऑपरेटर ऑब्जेक्ट का कंस्ट्रक्टर भी चलाता है और टाइपकास्टिंग की ज़रूरत नहीं पड़ती, जबकि `malloc()` केवल कच्ची मेमोरी देता है। -> इसलिए विकल्प (A) बिल्कुल सही है।
Question 2000 NEW
Most Important MEDIUM
What is the difference between `delete` and `delete[]` in C++?
C++ में `delete` और `delete[]` के बीच क्या अंतर है?
A
`delete` is valid, `delete[]` is a syntax error
`delete` वैध है, `delete[]` सिंटैक्स एरर है
B
`delete` frees memory of a single dynamically allocated object, whereas `delete[]` frees memory of a dynamically allocated array of objects
`delete` एकल ऑब्जेक्ट की मेमोरी मुक्त करता है, जबकि `delete[]` ऑब्जेक्ट्स के पूरे एरे की मेमोरी मुक्त करता है
Correct
C
`delete[]` is only for integers
`delete[]` केवल पूर्णांकों के लिए है
D
Both work identically
दोनों एक समान काम करते हैं
Solution Breakdown:
-> Memory allocated with `new` must be freed with `delete`, while array memory allocated with `new[]` must be freed with `delete[]` so every element's destructor runs properly. -> Hence, Option (B) is the correct answer.
-> `new` से बनी एकल मेमोरी को `delete` से और `new[]` से बने एरे को `delete[]` से मुक्त किया जाता है। -> इसलिए विकल्प (B) बिल्कुल सही है।
Prev 78 79 80 81 82 Next
ESSENTIAL STUDY KIT

Master Computer PYQs Faster with Recommended Resources

Pair your daily MCQ practice with these educator-picked books, practice sets, and typing gear tailored for this syllabus.

Visit Exam Store
Dell KB216 Wired Multimedia USB Keyboard (Black)
Typing Keyboards Best for Mangal Typing Amazon
Dell KB216 Wired Multimedia USB Keyboard (Black)

Soft chiclet keys and zero lag — the best keyboard for UPP Computer Operator and DSSSB 40+ WPM Hindi/English typing tests.

₹299 ₹999 70% OFF
Affiliate Disclosure: HappyQuiz may earn a small commission on qualifying purchases at no extra cost to you.
Saved to your dashboard!