Q1
Show answer without attempting
Answer: B
GATE CS · 4 February 2023 · Slot 1 · 65 questions
Every question from the GATE CS 2023 CS paper held on 4 February 2023, in the order it was printed, with the official answer key. Pick an option, or type the number for numerical-answer questions, and it is marked straight away with GATE marking: 1 or 2 marks, −⅓ or −⅔ for a wrong MCQ, no negative marks for MSQ and NAT.
Answer: B
Answer: Marks to all
Answer: A
Answer: A
Answer: C
Answer: D
Answer: C
Answer: D
Answer: B

Answer: A
Answer: B
Answer: B
SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list.SLLdel and DLLdel?Answer: D

Answer: C
Answer: A
Answer: A
Answer: B
Answer: B
id for an identifier in a programming language, using extended regular expressions:Answer: C
Answer: C

Answer: B
Answer: B, C, D
Answer: C, D
Answer: A, C, D
Answer: A, C
Answer: B, C
Answer: A, C, D OR C, D
Answer: B, D
Answer: A, C

Answer: 2 OR 4
Answer: 0
Answer: 110
Answer: 2040
Answer: 10.2
#include<stdio.h>
int funcp(){
static int x = 1;
x++;
return x;
}
int main(){
int x,y;
x = funcp();
y = funcp()+x;
printf("%d\n", (x+y));
return 0;
}Answer: 7
int main()
{
f1();
f2(2);
f3();
return(0);
}
int f1()
{
return(1);
}
int f2(int X)
{
f3();
if (X==1)
return f1();
else
return (X*f2(X-1));
}
int f3()
{
return(5);
}Answer: A

Answer: D
incr and decr shown below.incr(){
wait(s);
X = X+1;
signal(s);
}
decr(){
wait(s);
X = X-1;
signal(s);
}incr once, and 3 threads each invoking decr once, on the same shared variable X. The initial value of X is 10.s, as follows:s is a binary semaphore initialized to 1.s is a counting semaphore initialized to 2.X at the end of execution of all the threads with implementations I-1, I-2, respectively.Answer: C
Answer: B

Answer: A
//C-code
int a[10], b[10], i;
// int is 32-bit
for (i=0; i<10;i++)
a[i] = b[i] * 8;;assembly-code (; indicates comments)
;r1-r5 are 32-bit integer registers
;initialize r1=0, r2=10
;initialize r3, r4 with base address of a, b
L01: jeq r1, r2, end ;if(r1==r2) goto end
L02: lw r5, 0(r4) ;r5 <- Memory[r4+0]
L03: shl r5, r5, U1 ;r5 <- r5 << U1
L04: sw r5, 0(r3) ;Memory[r3+0] <- r5
L05: add r3, r3, U2 ;r3 <- r3+U2
L06: add r4, r4, U3
L07: add r1, r1, 1
L08: jmp U4 ;goto U4
L09: endAnswer: B

Answer: C

Answer: A

Answer: C
Answer: C
EXTRACT-MAX(A) extracts and deletes the maximum element from . The operation INSERT(A, key) inserts a new element key in . The properties of a max-heap are preserved at the end of each of these operations.Answer: B
foo and the binary tree shown.typedef struct node {
int val;
struct node *left, *right;
} node;
int foo(node *p) {
int retval;
if (p == NULL)
return 0;
else {
retval = p->val + foo(p->left) + foo(p->right);
printf("%d ", retval);
return retval;
}
}foo is called with a pointer to the root node of the given binary tree, what will it print?
Answer: C
Answer: D
Answer: B, C, D
myTCP, runs over a 100 Mbps network with Round Trip Time of 150 milliseconds and the maximum segment lifetime of 2 minutes.myTCP header?Answer: B, C, D
Answer: A, D
www.gate-2023.in URL. The browser cache is empty. The IP address for this URL is not cached in your local host, so a DNS lookup is triggered (by the local DNS server deployed on your local host) over the 3-tier DNS hierarchy in an iterative mode. No resource records are cached anywhere across all DNS servers.www.gate-2023.in is also equal to RTT. The HTML file associated with the URL is small enough to have negligible transmission time and negligible rendering time by your web browser, which references 10 equally small objects on the same web server.Answer: C, D
Answer: C, D
Function_1 and Function_2 expressed in pseudocode as follows:Function_1
while n > 1 do
for i = 1 to n do
x = x + 1;
end for
n = ⌊n/2⌋;
end while
Function_2
for i = 1 to 100 * n do
x = x + 1;
end forFunction_1 and Function_2, respectively.Answer: A, D
for i = 1, ..., n
color(vᵢ) ← min{j ∈ ℕ : no neighbour of vᵢ is colored j}Answer: A, B
Answer: 5040
D in the C programming language, which is stored in row-major order:int D[128][128];D. The Least Recently Used (LRU) page-replacement policy is used by the operating system. A total of 30 physical page frames are allocated to a process which executes the following code snippet:for (int i = 0; i < 128; i++)
for (int j = 0; j < 128; j++)
D[j][i] *= 10;Answer: 4096
Answer: 5
push the elements of from to in that order into .enqueue the elements of from to in that order into .pop an element from .dequeue an element from .pop an element from .dequeue an element from .dequeue an element from and push the same element into .pop an element from .pop an element from .top element of after executing the above operations is ____________.Answer: 8
#, 0 and 1 are lexical tokens corresponding to input letters "#", "0" and "1", respectively. denotes the synthesized attribute (a numeric value) associated with a non-terminal . and denote occurrences of and on the right hand side of a production, respectively. For the tokens 0 and 1, and .Answer: 2.374 to 2.376
Student in a relational database. The primary key of this table is rollNum.| rollNum | name | gender | marks |
|---|---|---|---|
| 1 | Naman | M | 62 |
| 2 | Aliya | F | 70 |
| 3 | Aliya | F | 80 |
| 4 | James | M | 82 |
| 5 | Swati | F | 65 |
SELECT *
FROM Student
WHERE gender = ‘F’ AND
marks > 65;Answer: 2

Answer: 6
Answer: 4
Answer: 19
| Subnet Number | Subnet Mask | Interface ID |
|---|---|---|
| 200.150.0.0 | 255.255.0.0 | 1 |
| 200.150.64.0 | 255.255.224.0 | 2 |
| 200.150.68.0 | 255.255.255.0 | 3 |
| 200.150.68.64 | 255.255.255.224 | 4 |
| Default | 0 |
200.150.68.118 arrives at the router. It will be forwarded to the interface with ID ____________.Answer: 3
0/650 correct0 marks