Vidyalelo
C Programming · all questions

C Miscellaneous
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

70

Questions

3/4

Page

Pick an option on a question to see the right answer and solution.

Determine Output:
void main()
{
      char *p;
      p="%d\n";
      p++;
      p++;
      printf(p-2, 300);
}

Select an option to see the answer and solution.

Determine Output:
void main()
{
      int c[] = {2.8,3.4,4,6.7,5};
      int j, *p=c, *q=c;
      for(j=0;j<5;j++){
            printf(" %d ", *c);
            ++q;
      }
      for(j=0;j<5;j++){
            printf(" %d ", *p);
            ++p;
      }
}

Select an option to see the answer and solution.

Determine Output:
void main()
{
      int a[] = {10,20,30,40,50}, j, *p;
      for(j=0; j<5; j++){
            printf("%d" ,*a);
            a++;
      }
      p = a;
      for(j=0; j<5; j++){
            printf("%d" ,*p); 
            p++;
      }
}

Select an option to see the answer and solution.

Determine Output:
#include<stdio.h>
void main()
{
      char s[]={'a','b','c','n','c','\0'}; 
      char *p, *str, *str1; 
      p=&s[3]; 
      str=p;
      str1=s;
      printf("%c", ++*p + ++*str1-32);
}

Select an option to see the answer and solution.

Determine Output:
void main()
{
      static char *s[] = {"black", "white", "yellow", "violet"};
      char **ptr[] = {s+3, s+2, s+1, s}, ***p;
      p = ptr;
      ++p; 
      printf("%s",*--*++p + 3); 
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
main()
{
    int n;
    n=f1(4);
    printf("%d",n);
}
f1(int x)
{
    int b;
    if(x==1)
        return 1;
    else
        b=x*f1(x-1);
        return b;
}

Select an option to see the answer and solution.

In the absence of a exit condition in a recursive function, the following error is given . . . . . . . .

Select an option to see the answer and solution.

What is the output of this C code?
#include <stdio.h>
main()
{
    if (sizeof(int) > -1)
        printf("True");
    else
        printf("False");
}

Select an option to see the answer and solution.

What will be the value of the following assignment expression?
(x = foo())!= 1 considering foo() returns 2

Select an option to see the answer and solution.

Suppose we have: int a=100; (signed by default).
If we want to convert this to an unsigned long integer, we can do this by making the following small change:

Select an option to see the answer and solution.

Suppose we transfer a file written on a little endian machine to a big endian machine and there is no transformation from little endian to big endian, then what happens?

Select an option to see the answer and solution.

File formats which have . . . . . . . . as a basic unit are independent of endianness.

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
static inline int max(int a, int b) 
{
  return a > b ? a : b;
}
main()
{
    int m;
    m=max(-6,-5);
    printf("%d",m);
}

Select an option to see the answer and solution.

Sign qualifiers can be applied to double.

Select an option to see the answer and solution.

What is the output of this C code?
#include <stdio.h>
main()
{
    char *p = "Examveda C-Test";
    p[0] = 'a';
    p[1] = 'b';
    printf("%s", p);
}

Select an option to see the answer and solution.

The following C code results in an error. State whether this statement is true or false.
#include <stdio.h>
void f(double b) 
{
    printf ("%ld\n",b);
}
int main() 
{
     inline f(100.56);
     return 0;
}

Select an option to see the answer and solution.

What will be the output of the following C code?
main()
{
    unsigned a=10;
    long unsigned b=5l;
    printf(“%lu%u”,a,b);
}

Select an option to see the answer and solution.

What is the binary representation of the integer -14?

Select an option to see the answer and solution.

Functions in C Language are always . . . . . . . .

Select an option to see the answer and solution.

What will be the error in the following C code?
main()
{
    long float a=-25.373e22;
    printf("%lf",a);
}

Select an option to see the answer and solution.