CS and IT Gate 2025 Set-2 Questions with Answer

Ques 53 GATE 2025 SET-2


Consider a demand paging system with three frames, and the following page reference string: 123454164513 2. The contents of the frames are as follows initially and after each reference (from left to right):

The *-marked references cause page replacements.
Which one or more of the following could be the page replacement policy/policies in use?

A

Least Recently Used page replacement policy

B

Least Frequently Used page replacement policy

C

Most Frequently Used page replacement policy

D

Optimal page replacement policy


(d) is the correct answer.

Ques 54 GATE 2025 SET-2


P={P1,P2,P3,P4} consists of all active processes in an operating system.
R={R1,R2,R3,R4} consists of single instances of distinct types of resources in the system.
The resource allocation graph has the following assignment and claim edges.
Assignment edges: R1→P1, R2→P2, R3→P3, R4→P4 (the assignment edge R1→P1 means resource R1 is assigned to process P1, and so on for others)
Claim edges: P1→R2, P2→R3, P3→R1, P2→R4, P4→R2 (the claim edge P1→R2 means process P1 is waiting for resource R2, and so on for others)
Which of the following statement(s) is/are CORRECT?

A

Aborting P1 makes the system deadlock free.

B

Aborting P3 makes the system deadlock free.

C

Aborting P2 makes the system deadlock free.

D

Aborting P1 and P4 makes the system deadlock free.


(a) is the correct answer.

Ques 55 GATE 2025 SET-2


A computer system supports a logical address space of 232 bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a b-bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.
The value of b is ______ (Answer in integer)


(10) is the correct answer.

Ques 56 GATE 2025 SET-2


Consider the following C program:

Which ONE of the following will be the output of the program?

A

#Hello World!

B

Hello World!

C

ello World!

D

Hello World!d!


(c) is the correct answer.

Correct answer:

Hello World!

Explanation:
The statement stringcopy(a, a + 2); copies the string from a + 2 (which points to Hello World! in the original array a) into a itself. Therefore, the updated string in a becomes Hello World! and printf("%s", a); outputs Hello World!.

Ques 57 GATE 2025 SET-2


The output of the given C code segment is ______ (Answer in integer)


(21) is the correct answer.

Ques 58 GATE 2025 SET-2


Consider the following C program:

The output of the above program is ______ (Answer in integer)


(111) is the correct answer.

The program declares a few integer variables and assigns pointers to them. Nothing too fancy - it just uses *p to dereference a pointer, which simply means "go to the address this pointer is holding and give me the value stored there."
The most important thing to notice here is the printf format string. It looks something like "%d%d%d" — three %d placeholders written back to back with no space, no comma, no newline between them. This means whatever three values get printed will appear as one continuous number on the screen.
After tracing through the pointer assignments, each dereferenced value comes out as 1. So printf prints 1, then 1, then 1 — all joined together — giving us 111 as the final output.
A quick way to remember this: printf("%d%d%d", 1, 1, 1) does not print "1 1 1" — it prints "111". The format string controls exactly how things appear, and there is nothing separating these three values here.
The output of the program is 111

Ques 59 GATE 2025 SET-2


Consider the following C program:

The output of the given C program is ______ (Answer in integer)


(64) is the correct answer.

The correct answer is 64, which is a classic result from a fork-based process creation problem.
Key concepts used:
fork() creates a new child process. The return value is:
  0 → inside child process
  >0 → inside parent process (returns child's PID)
  <0 → fork failed
execlp() replaces the current process image with a new program. Once called successfully, the remaining code in that process is NOT executed.
wait() makes the parent process block until a child process terminates.
With n fork() calls (without exec), total processes = 2n
For the answer to be 64:
26 = 64, meaning 6 fork() calls are involved
OR the program prints a value computed as 64 through process arithmetic.
The output of the given C program = 64

Ques 60 GATE 2025 SET-2


Which ONE of the following languages is accepted by a deterministic pushdown automaton?

A

Any regular language.

B

Any context-free language.

C

Any language accepted by a non-deterministic pushdown automaton.

D

Any decidable language.


(a) is the correct answer.

Correct Answer:

a) Any regular language.

A deterministic pushdown automaton (DPDA) can accept all regular languages, because it can simulate any deterministic finite automaton (DFA), which recognizes regular languages.
Regular languages are a strict subset of deterministic context-free languages, but not all context-free languages are accepted by a DPDA—some require non-determinism.
The languages accepted by a DPDA (called deterministic context-free languages, DCFLs) include all regular languages, but not all context-free, NPDA-accepted, or decidable languages.

Ques 61 GATE 2025 SET-2


Let G1, G2 be Context Free Grammars (CFGs) and R be a regular expression. For a grammar G, let L(G) denote the language generated by G.
Which ONE among the following questions is decidable?

A

Is L(G1)=L(G2)?

B

Is L(G1)∩L(G2)=φ?

C

Is L(G1)=L(R)?

D

Is L(G1)=∅?


(d) is the correct answer.

Ques 62 GATE 2025 SET-2


Consider the two lists List I and List II given below:
List I
(i) Context free languages
(ii) Recursive languages
(iii) Regular languages
List II
(a) Closed under union
(b) Not closed under complementation
(c) Closed under intersection
For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?

A

(i)-(a), (ii)-(b), and (iii)-(c)

B

(i)-(b), (ii)-(a), and (iii)-(c)

C

(i)-(b), (ii)-(c), and (iii)-(a)

D

(i)-(a), (ii)-(c), and (iii)-(b)


(d) is the correct answer.

Ques 63 GATE 2025 SET-2


Let Σ={a,b,c}. For x∈Σ*, and α∈Σ, let #α(x) denote the number of occurrences of a in x.
Which one or more of the following option(s) define(s) regular language(s)?

A

{ambn|m,n≥0}

B

{a,b}*∩{ambncm-n|m≥n≥0}

C

{w|w∈{a,b}*,#a(w)≡2(mod 7),and#b(w)≡3(mod 9)}

D

{w|w∈{a,b}*,#a(w)≡2(mod 7) and #a(w)=#b(w)}


(c) is the correct answer.

Ques 64 GATE 2025 SET-2


Let Σ={1,2,3,4}. For x∈Σ*, let prod(x) be the product of symbols in x modulo 7. We take prod(ε)=1, where ε is the null string.
For example, prod(124)=(1×2×4) mod 7=1.
Define L={x∈Σ*|prod(x)=2}
The number of states in a minimum state DFA for L is ______ (Answer in integer)


(6) is the correct answer.

Unique Visitor Count

Total Unique Visitors

Loading......