Texas Previous Years Solved Sample Placement Papers
-
In the circuit given below, the switch is opened at time t=0. Voltage across the capacitor at t=∞ is:
A. 2V
B. 3V
C. 5V
D. 7V Answer: Option D
- Solution: At t=∞, the capacitor reaches steady-state voltage determined by the circuit's configuration.
-
What is the functionality represented by the following circuit?
A. y = !(b + ac)
B. y = !(a + bc)
C. y = !(a(b + c))
D. y = !(a + b + c) Answer: Option B
- Solution: The circuit represents a NOT gate with input logic `a + bc`.
-
The value (0xdeadbeef) needs to be stored at address 0x400. Which of the below ways will the memory look like in a big-endian machine?
A. be ef de ad
B. ef be ad de
C. fe eb da ed
D. ed da eb fe Answer: Option A
- Solution: In big-endian format, the most significant byte is stored at the lowest memory address.
-
In a given CPU-memory sub-system, all accesses to the memory take two cycles. Which of the following mechanisms guarantees correct data transfer?
A. A read operation followed by a write operation in the next cycle.
B. A write operation followed by a read operation in the next cycle.
C. A NOP between every successive reads & writes Answer: Option C
D. None of the above
- Solution: Adding a NOP ensures no data conflicts occur between successive read and write operations.
-
An architecture saves 4 control registers automatically on function entry (and restores them on function return). Save of each register costs 1 cycle (so does restore). How many cycles are spent while running the following code with n=5?
void fib(int n) { if ((n == 0) || (n == 1)) return 1; return(fib(n - 1) + fib(n - 2)); }
A. 120
B. 80
C. 125
D. 128 Answer: Option D
- Solution: The function call involves repeated saves/restores of control registers. Total cycles depend on the recursion depth and number of function calls.
-
Swapping without using a temporary variable:
(i) x = x + y; y = x - y; x = x - y;
(ii) x = x ^ y; y = x ^ y; x = x ^ y;
-
Count the number of 1's in a word without using bit-by-bit operations:
Solution: Use bitwise operations like `value &= value - 1` in a loop to count set bits efficiently. -
Given two codes:
Code 1: for (i = 0; i < 1000; i++) for (j = 0; j < 100; j++) x = y;
Code 2: for (i = 0; i < 100; i++) for (j = 0; j < 1000; j++) x = y;
Which code executes faster?
A. Code 1 and Code 2 are of the same speed
B. Code 1
C. Code 2 Answer: Option C
D. None
- Solution: Code 2 executes faster because it accesses memory in a cache-friendly manner.
-
Output of the program:
main() { int a[10] = {1, 2, 3, ..., 10}, i, x = 10, temp; for (i = 0; i < x / 2; i++) { temp = a[i]; a[i] = a[x - i - 1]; a[x - i - 1] = temp; }}
A. All contents of array a are reversed
B. Only some portions are altered
C. Remains the same
D. None Answer: Option A
- Solution: The array is reversed completely by swapping elements symmetrically.
-
In C, which parameter passing technique is used?
A. Call by value Answer: Option A
B. Call by reference
C. Both
- Solution: C only supports call by value natively. References are emulated using pointers.
-
Output of the program:
main() { int i = 1; fork(); fork(); printf("\ni = %d\n", i + 1); }
A. 2 printfs will occur
B. 4 printfs will occur Answer: Option B
C. 6 printfs will occur
D. Undefined behavior
- Solution: Each `fork()` creates a new process, doubling the number of processes. Initially, 1 process becomes 4, each printing the result.