What is the output of the following C code?
void foo(int *p, int x) { *p = x; } void main() { int *z; int a = 20, b = 25; z = a; // Incorrect: Should be z = a; foo(z, b); printf("%d", a); }
Issue: The statement z = a; is invalid because a is an integer, and z is a pointer.
z = a;
a
z
Which of the following is the greatest? \[ 0.6, \ 0.666, \ \frac{5}{6}, \ \frac{2}{3} \]
Consider the following C code:
int main() { sum = 0; for (n = 1; n < 3; n++) { n++; sum += g(f(n)); } printf("%d", sum); } int g(n) { return 10 + n; } int f(n) { return g(2 * n); }
What is the output?
Consider the following code:
int a; int arr[] = {30, 50, 10}; int *ptr = arr[10] + 1; a = *ptr; (*ptr)++; ptr = ptr + 1; printf("%d", a + arr[1] + *ptr);
Find the signed binary expansion of the number -6.
Match the following layers with their corresponding functionalities:
Given the following information: The logical address (L.A.) is 32 bits. The physical address (P.A.) is 20 bits. The page size (P.S.) is 2048 bytes (2 KB). What is the maximum number of entries in the page table?
Let \( A \) be a \( 3 \times 3 \) matrix defined as:
Find the eigenvalues of \( A^{13} \).
What is the time complexity of the following algorithm? int func(int n) { for (int i = 1; i < = n; i++) { for (int j = 1; j < = n; j++) { printf("Hello"); } } }
Given an array \( A[n] \) such that:
Find the time complexity to find \( A[i] \).
Given the matrix \( A = \begin{bmatrix} 1 & 2 \\ 2 & -1 \end{bmatrix} \), find \( A^8 \).
Consider the following operations on an initially empty stack: Push 10 Push 20 Pop Push 30 Pop Push 40 What is the final content of the stack?
Consider the following process information for Shortest Remaining Time First (SRTF) scheduling:
Find the turnaround time for each process.
Given the following cache parameters:
Find the size of the main memory and the size of the cache memory.
Which of the following is true about the binary search algorithm when applied to a sorted array?
Given a pipeline with 5 stages, the delay for each stage is as follows:
The buffer delay is 10 ns. Find the time for \( n = 1000 \) instructions.
Consider the following hierarchical cache system with the following access times:
Find \( T_{avg} \) for hierarchical or simultaneous access.
main() { int x = 126, y = 105; { if (x > y) x = x - y; else y = y - x; } while (x != y) printf("%d", x); }