GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2025 set2

GATE 2025 set2 · CS · MCQ · 1 mark · Programming and Data Structures › C Programming Fundamentals

GATE 2025 set2 Computer Science and Information Technology question: Consider the following C program: code Which ONE of the following will be the output of…

Consider the following C program:

#include <stdio.h>
void stringcopy(char *, char *);
int main(){
    char a[30] = "@#Hello World!";
    stringcopy(a, a + 2);
    printf("%s\n", a);
    return 0;
}
void stringcopy(char *s, char *t) {
    while(*t)
        *s++ = *t++;
}

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

  1. (A)

    @#Hello World!

  2. (B)

    Hello World!

  3. (C)

    ello World!

  4. (D)

    Hello World!d!

Show answer

Official answer: D

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion