GATE 2025 (Session 1) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2025 (Session 1)

65 questions

MCQ 30 · MSQ 13 · NAT 221-mark 30 · 2-mark 35

Questions 61–65 of 65

Q61Function2 marksNAT
#include <stdio.h>  
int foo(int S[],int size){  
    if(size == 0) return 0;  
    if(size == 1) return 1;  
    if(S[0] != S[1]) return 1+foo(S+1,size-1);  
    return foo(S+1,size-1);  
}  
int main(){  
    int A[]={0,1,2,2,2,0,0,1,1};  
    printf("%d",foo(A,9));  
    return 0;  
}  
The value printed by the given C program is _________. (Answer in integer).

Q63Loop2 marksNAT
Consider the following C program:

#include <stdio.h>  
int gate(int n) {  
    int d, t, newnum, turn;  
    newnum = turn = 0; t=1;  
    while(n >= t) t *= 10;  
    t /= 10;  
    while(t > 0) {  
        d = n / t;  
        n = n % t;  
        t /= 10;  
        if(turn) newnum = 10 * newnum + d;  
        turn = (turn + 1) % 2;  
    }  
    return newnum;  
}  
int main () {  
    printf("%d", gate(14362));  
    return 0;  
}
The value printed by the given C program is _________. (Answer in integer)

Q64Minimum Spanning Tree2 marksNAT
The maximum value of xx such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is _________. (Answer in integer)
ABDC 7136x8

Q65Hashing2 marksNAT
In a double hashing scheme, h1(k)=kmod  11h_1(k) = k \mod 11 and h2(k)=1+(kmod  7)h_2(k) = 1 + (k \mod 7) are the auxiliary hash functions. The size mm of the hash table is 11. The hash function for the ii-th probe in the open address table is [h1(k)+ih2(k)]mod  m[h_1(k) + i h_2(k)] \mod m The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.

The slot at which key 24 gets stored is _________. (Answer in integer)