NSCT PAST PAPERS AND SYLLABUS
فری تیاری کیلے وٹس ایپ
گروپ جوائن کریں
Click here
چار آپشن میں سے کسی ایک پر کلک کرنے سے جواب سرخ ہو جائے گا۔
- To encrypt data
- To prevent multiple threads from accessing shared resources simultaneously
- To speed up execution
- To handle recursion
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
A mutex (mutual exclusion) lock ensures that only one thread can access a shared resource at a time.
It prevents race conditions, where multiple threads modify data simultaneously.
Threads must acquire the mutex before using the resource and release it afterward.
Mutexes are commonly used in multithreading and concurrent programming.
Proper use of mutexes ensures data consistency and program stability.
- Matplotlib
- NumPy
- Seaborn
- Scikit-learn
اس سوال کو وضاحت کے ساتھ پڑھیں
Explanation
NumPy is a Python library for numerical computation and array operations.
It provides fast mathematical functions for large datasets.
Many machine learning libraries like TensorFlow and Scikit-learn use NumPy arrays internally.
Matplotlib and Seaborn are for visualization, not computation.
- 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.