NSCT PAST PAPERS AND SYLLABUS
فری تیاری کیلے وٹس ایپ
گروپ جوائن کریں
Click here
چار آپشن میں سے کسی ایک پر کلک کرنے سے جواب سرخ ہو جائے گا۔
- i + 1
- i / 2
- 2 * i
- i - 1
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
In a max-heap using 1-based indexing, the parent of a node at index i is at index i / 2.
The left child of node i is at index 2 * i, and the right child is at index 2 * i + 1.
This property helps in efficient heap operations like insert and delete.
Max-heaps maintain the largest element at the root.
- 4
- 8
- 12
- 16
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
The Cartesian product means pairing every element of set A with every element of set B.
Formula:
Number of elements in A × B = (number of elements in A) × (number of elements in B)
Given:
-
A has 4 elements
-
B has 4 elements
So: 4 × 4 = 16
- 5
- 7
- 10
- 14
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
Probability = (favorable outcomes) / (total outcomes)
2/7=red marbles/total marbles
Total marbles = 7
کون سا بیان سب سے بہتر طریقے سے ٹرانزٹیو ریلیشن کی وضاحت کرتا ہے؟
- If A > B and B > C, then A > C
- If A = B and B ≠ C, then A = C
- If A is adjacent to B, then B is adjacent to A
- If A is connected to B, then B is disconnected from A
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
A transitive relation means that if a relation holds between A and B, and B and C, it also holds between A and C.
Example: “greater than” (>) is transitive: if 5 > 3 and 3 > 2, then 5 > 2.
This property is important in mathematics and computer science.
Relations like adjacency or inequality may or may not be transitive.
Understanding transitivity helps in reasoning and designing algorithms.
- 0
- 1
- 2
- 3
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
- Output of code (bool b = false; cout << b + 2;)
- false = 0, so 0 + 2 = 2 → Output = 2
- 0
- 1
- Error
- Undefined
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
&& is evaluated before || due to operator precedence.
a && b gives 0 because one operand is false.
Then a || 0 is evaluated.
1 || 0 gives 1.
So the program prints 1.
- O(n)
- O(log n)
- O(n²)
- O(n log n)
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
A loop inside another loop is called a nested loop.
If both loops run n times, the inner loop runs n times for each iteration of the outer loop.
Total iterations = n × n = n².
Therefore, the time complexity is O(n²).
ڈیٹا سٹرکچرز میں، ان شفٹ کیا کرتا ہے؟
- Adds an element to the beginning
- Removes the last element
- Removes the first element
- Adds an element to the end
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
- In arrays or lists, unshift adds a new element to the start of the structure.
- The existing elements are shifted one position to the right to make space.
- The opposite operation is shift, which removes the first element.
- Unshift is useful when you need to prioritize new elements at the front.
- It is commonly used in queue implementations and array manipulations.
ڈیٹا سٹرکچرز میں، شفٹ کیا کرتا ہے؟
- Removes the first element
- Adds an element to the end
- Removes the last element
- Adds an element to the beginning
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
- In arrays or lists, shift removes the first element.
- The remaining elements are shifted one position to the left to fill the gap.
- The opposite operation is unshift, which adds an element to the beginning.
- Shift is useful in queue implementations where the first element is processed first.
- It helps in efficiently managing data in ordered sequences.
ڈیٹا سٹرکچرز میں، پُش کیا کرتا ہے؟
- Removes the first element
- Adds an element to the end
- Removes the last element
- Adds an element to the beginning
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
In stack data structures, push is used to add an element.
The element is added to the top of the stack (end of the structure).
The opposite operation is pop, which removes the top element.
Stacks follow the LIFO (Last In, First Out) principle.
Push helps in storing data temporarily during computations and function calls.