C programming

Test your knowledge of C programming fundamentals including pointers, operators, loops, data types, and standard library functions through code output questions.

13 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Wild pointer in 'C' ____________.

  1. is initialized by constant
  2. is not initialized.
  3. does not exist in C language
  4. only takes 'int' values
  5. works like null pointer
Question 2 Multiple Choice (Single Answer)

Find the output of the following expression.
#include<stdio.h>
#include<conio.h>
void main()
{
int x, y =3;
x= ++y + 7;
printf(" %d " , x)
}

  1. 10
  2. 11
  3. 8
  4. 12
  5. None of the above
Question 3 Multiple Choice (Single Answer)

FInd the output of the following expression.
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=1;i<5;i++)
printf(" %d ",i);
}

  1. 1 2 3 4 5
  2. 1 2 3 4
  3. 1 2 3 4 5 6
  4. 0 1 2 3 4 5
  5. None of the above
Question 4 Multiple Choice (Single Answer)

Find the value of C.
C = (a>0 && a<1)? a : b given a =10 , b = 20

  1. 10
  2. 20
  3. C will take garbage value
  4. 0 or 1
  5. None of these
Question 5 Multiple Choice (Single Answer)

Find the output of the following expression.
#include<stdio.h>
#iinclude<conio.h>
void main()
{
int x=5 , y;
y = ++x;
printf(%d , y);
}

  1. 6
  2. 5
  3. 7
  4. Wrong expression
  5. None of these
Question 6 Multiple Choice (Single Answer)

In how many categories can the data types of C be classified?

  1. 5
  2. 4
  3. 3
  4. 2
  5. None of the above
Question 7 Multiple Choice (Single Answer)

Which of the following given standard functions accepts two arguments while calling?

  1. strspn();
  2. strnset();
  3. strnsetu();
  4. strdup();
  5. strncpyk();
Question 8 Multiple Choice (Single Answer)

How many valid categories of character sets are there in C language?

  1. 5
  2. 4
  3. 3
  4. 2
  5. None of these
Question 9 Multiple Choice (Single Answer)

Find out the output of the following program or error (if any).

#include<stdio.h>
#include<conio.h>
int main()
{
 const int num=12;
 ++num;
 printf("num=%d",num);
 getch();
}

  1. Num=12
  2. Num=13
  3. Garbage value
  4. Error in the program
  5. Blank screen (no output)
Question 10 Multiple Choice (Single Answer)

Which of the following arithmetic operations is/are not possible in C language?

  1. Addition of two addresses
  2. Multiplication of two addresses
  3. Multiplication of an address with a constant
  4. Divison of an address with a constant
  5. All of the above
Question 11 Multiple Choice (Single Answer)

Find out the output of the given program or error (if any).

#include<stdio.h>

#include<conio.h>

int main()
{
 unsigned u=65535;
 printf("u=%d",u);
 getch();
}

  1. u=1
  2. u=2
  3. u=65535
  4. error in the program
  5. None of these
Question 12 Multiple Choice (Single Answer)

Which of the following is/are the standard header files in ANSII C?

  1. <assert.h>
  2. <complex.h>
  3. <limits.h>
  4. Both 1 and 3
  5. All 1, 2 and 3
Question 13 Multiple Choice (Single Answer)

What is the ASCII value of ESC character?

 #include<stdio.h>

#include<conio.h>

using namespace std;

class first

{

      int b;

      public:

             first()

             {

                    b=10;

                    }

                    void display()

                    {

                         cout<<\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n b=<

                         }

                         };

                         class second

                         {

                               int d;

                               public:

                                      second()

                                      { d=20;

                                      }

                                      void display()

                                      {

                                            cout<<\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n d=<

                                            }

                                            };

                                            int main()

                                            {

                                                first f,*p;

                                                second s,*i;

                                                p=&f;

                                                p->display();

                                                i=&s;

                                                p->display();

                                                getch();

                                                }

  1. 27
  2. 28
  3. 29
  4. 30
  5. None of these