GATE Computer Science Engineering(CSE) 2027 Test: Programming in C Free


MCQ Practice Test & Solutions: Test: Programming in C (10 Questions)

You can prepare effectively for Computer Science Engineering (CSE) GATE Computer Science Engineering(CSE) 2027 Mock Test Series with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: Programming in C". These 10 questions have been designed by the experts with the latest curriculum of Computer Science Engineering (CSE) 2026, to help you master the concept.

Test Highlights:

  • - Format: Multiple Choice Questions (MCQ)
  • - Duration: 30 minutes
  • - Number of Questions: 10

Sign up on EduRev for free to attempt this test and track your preparation progress.

Test: Programming in C - Question 1

Which of the following is not a logical operator?

Detailed Solution: Question 1

&&- Logical AND 
!- Logical NOT 
||- Logical OR 
|- Bitwise OR(used in bitwise manipulations)

Test: Programming in C - Question 2

Which of the following is true about return type of functions in C?

Detailed Solution: Question 2

In C, functions can return any type except arrays and functions. We can get around this limitation by returning pointer to array or pointer to function.

Test: Programming in C - Question 3

Consider the following C declaration

struct { 
    short s[5];
    union { 
         float y; 
         long z; 
    }u; 
} t;

Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is 

Detailed Solution: Question 3

Short array s[5] will take 10 bytes as size of short is 2 bytes.

When we declare a union, memory allocated for the union is equal to memory needed for the largest member of it, and all members share this same memory space. Since u is a union, memory allocated to u will be max of float y(4 bytes) and long z(8 bytes). So, total size will be 18 bytes (10 + 8).

Test: Programming in C - Question 4

#include <stdio.h>
int main()
{
    int i = 3;
    printf("%d", (++i)++);
    return 0;
}

What is the output of the above program?

Detailed Solution: Question 4

In C, prefix and postfix operators need l-value to perform operation and return r-value. The expression (++i)++ when executed increments the value of variable i(i is a l-value) and returns r-value. The compiler generates the error(l-value required) when it tries to post-incremeny the value of a r-value.

Test: Programming in C - Question 5

Find the Output ?

#include<stdio.h>

int main() 

  int x, y = 5, z = 5; 

  x = y == z; 

  printf("%d", x); 

  getchar(); 

  return 0; 

}

Detailed Solution: Question 5

  1. Variable Declaration and Initialization:

    c

    Copy code

    int x, y = 5, z = 5;

    • x, y, and z are declared as integers.
    • y and z are initialized to 5.
  2. Assignment and Comparison:

    c

    Copy code

    x = y == z;

    • Here, y == z is a comparison operation (y equals z).
    • Since y and z both hold the value 5, y == z evaluates to true, which is represented as 1 in C.
  3. Assignment Result:

    • The result of y == z (which is 1) is assigned to x.
    • Therefore, x now holds the value 1.
  4. Printing the Result:

    c

    Copy code

    printf("%d", x);

    • This line prints the value of x.
    • x currently holds 1, so 1 is printed to the console.
  5. Final Steps:

    c

    Copy code

    getchar(); return 0;

    • getchar() is used to wait for a character input (typically used to keep the console window open).
    • return 0; indicates successful completion of the main function.

Therefore, when you run this program, it will output:

Copy code

1

Test: Programming in C - Question 6

Which file is generated after pre-processing of a C program?

Detailed Solution: Question 6

After the pre-processing of a C program, a .i file is generated which is passed to the compiler for compilation. 

Test: Programming in C - Question 7

Which of the following is not a storage class specifier in C?

Detailed Solution: Question 7

volatile is not a storage class specifier. volatile and const are type qualifiers.

Test: Programming in C - Question 8

In C, parameters are always

Detailed Solution: Question 8

In C, function parameters are always passed by value. Pass-by-reference is simulated in C by explicitly passing pointer values.

Test: Programming in C - Question 9

#include <stdio.h>
#if X == 3
    #define Y 3
#else
    #define Y 5
#endif

int main()
{
    printf("%d", Y);
    return 0;
}

What is the output of the above program?

Detailed Solution: Question 9

The output of the given program depends on the value of X.

However, in the given code, the value of X is not explicitly defined, so its value is undefined. If X is not defined or if its value is not explicitly set before the preprocessing phase, it is considered as 0 by default.

Since X is not defined, the #if X == 3 directive evaluates to false, and therefore, the else part of the #if directive is used, setting Y to 5.

So, the output of the program will be:

Test: Programming in C - Question 10

#include <stdio.h>
// Assume base address of "EduRevQuiz" to be 1000
int main()
{
   printf(5 + "Quiz");
   return 0;
}

Detailed Solution: Question 10

56 docs|215 tests
Information about Test: Programming in C Page
In this test you can find the Exam questions for Test: Programming in C solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Programming in C, EduRev gives you an ample number of Online tests for practice
Download as PDF