GATE CS 2024 (Afternoon) — Question 33

Programming in CPointers, Multi-Dimensional Arrays, StructuresMSQ1 markMedium

Consider the following C function definition:
c
1int fx(char *a) {
2    char *b = a;
3    while (*b)
4        b++;
5    return b - a;
6}
7
Which of the following statements is/are TRUE?
  1. A
    The function call fx(“abcd”) will always return a value.
  2. B
    Assuming a character array c is declared as char c[ ] = “abcd” in main( ), the function call fx(c) will always return a value.
  3. C
    The code of the function will not compile.
  4. D
    Assuming a character pointer c is declared as char *c = “abcd” in main( ), the function call fx(c) will always return a value.
Practise the full 2024-AN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAWhat rank do your marks get?GATE score, likely All-India Rank and qualifying marks for your category.
Practise more on Pointers, Multi-Dimensional Arrays, StructuresTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group