Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Test: Programming in C - Computer Science Engineering (CSE) MCQ

Test: Programming in C - Computer Science Engineering (CSE) MCQ


Test Description

10 Questions MCQ Test - Test: Programming in C

Test: Programming in C for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Test: Programming in C questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Programming in C MCQs are made for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Programming in C below.
Solutions of Test: Programming in C questions in English are available as part of our course for Computer Science Engineering (CSE) & Test: Programming in C solutions in Hindi for Computer Science Engineering (CSE) course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Programming in C | 10 questions in 30 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Test: Programming in C - Question 1

Which of the following is not a logical operator?

Detailed Solution for Test: Programming in C - 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 for Test: Programming in C - 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.

1 Crore+ students have signed up on EduRev. Have you? Download the App
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 for Test: Programming in C - 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 for Test: Programming in C - 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 for Test: Programming in C - 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 for Test: Programming in C - 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 for Test: Programming in C - 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 for Test: Programming in C - 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 for Test: Programming in C - 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 for Test: Programming in C - Question 10

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

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)