C-star Round-2 Set-1

21 Questions | Total Attempts: 39

SettingsSettingsSettings
C-star   Round-2 Set-1 - Quiz


Questions and Answers
  • 1. 
     Assume that an int variable takes 4 bytes and a char variable takes 1 byte
    • A. 

      Number of elements between two pointer are: 5. Number of bytes between two pointers are: 20

    • B. 

      Number of elements between two pointer are: 20. Number of bytes between two pointers are: 20

    • C. 

      Number of elements between two pointer are: 5. Number of bytes between two pointers are: 5

    • D. 

       Compiler Error

  • 2. 
     What would be the equivalent pointer expression for referring the array element a[i][j][k][l]
    • A. 

      ((((a+i)+j)+k)+l)

    • B. 

      *(*(*(*(a+i)+j)+k)+l)

    • C. 

      (((a+i)+j)+k+l)

    • D. 

      ((a+i)+j+k+l)

  • 3. 
     What will be the value of var for the following C statement? var = strcmp("Hello", "World");
    • A. 

      -1

    • B. 

      0

    • C. 

      1

    • D. 

      Strcmp has void return-type

  • 4. 
     Which pre-defined function returns a pointer to the last occurence of a character in a string?
    • A. 

      Strchr(s, c);

    • B. 

      Strrchr(s, c);

    • C. 

      Strlchr(s, c);

    • D. 

      Strfchr(s, c);

  • 5. 
    The following C expression can be substituted for?  if (isalpha(c) && isdigit(c))
    • A. 

       if (isalnum(c))

    • B. 

       if (isalphanum(c))

    • C. 

       if (isalphanumeric(c))

    • D. 

      None of the mentioned

  • 6. 
    Which of the following structure declaration will throw an error?
    • A. 

      Struct temp{}s; main(){}

    • B. 

      Struct temp{}; struct temp s; main(){}

    • C. 

      Struct temp s; struct temp{}; main(){}

    • D. 

      None of the mentioned

  • 7. 
    How will you print \n on the screen?
    • A. 

      Printf(“\n”);

    • B. 

      Echo “\\n”;

    • C. 

      Printf(‘\n’);

    • D. 

      Printf (“\\n”)

  • 8. 
    Assuming, integer is 2 byte, What will be the output of the program?   #include<stdio.h>   int main() {     printf("%x\n", -1>>1);     return 0; }
    • A. 

      Ffff

    • B. 

      0fff

    • C. 

      0000

    • D. 

      Fff0

  • 9. 
    What will be the output of the program?   #include<stdio.h> #define SQUARE(x) x*x   int main() {     float s=10, u=30, t=2, a;     a = 2*(s-u*t)/SQUARE(t);     printf("Result = %f", a);     return 0; }
    • A. 

      Result = -100.00000

    • B. 

      Result = -25.000000

    • C. 

      Result = 0.000000

    • D. 

      Result = 100.000000

  • 10. 
    What will be the output of the program ?   #include<stdio.h> #include<string.h>   int main() {     char str1[20] = "Hello", str2[20] = " World";     printf("%s\n", strcpy(str2, strcat(str1, str2)));     return 0; }
    • A. 

      Hello

    • B. 

      World

    • C. 

      Hello World

    • D. 

      WorldHello

  • 11. 
    What will be the output of the program?   #include<stdio.h>   int main() {     unsigned int res;     res = (64 >>(2+1-2)) & (~(1<<2));     printf("%d\n", res);     return 0; }
    • A. 

      32

    • B. 

      64

    • C. 

      0

    • D. 

      128

  • 12. 
    What will be the output of the program ?   #include<stdio.h>   int main() {     union var     {         int a, b;     };     union var v;     v.a=10;     v.b=20;     printf("%d\n", v.a);     return 0; }
    • A. 

      10

    • B. 

      20

    • C. 

      30

    • D. 

      0

  • 13. 
    Which of the following statements are correct about the program?   #include<stdio.h>   int main() {     unsigned int num;     int i;     scanf("%u", &num);     for(i=0; i<16; i++)     {         printf("%d", (num<<i & 1<<15)?1:0);     }     return 0;
    • A. 

      It prints all even bits from num

    • B. 

      It prints all odd bits from num

    • C. 

      It prints binary equivalent num

    • D. 

      Error

  • 14. 
     What will be the output of the program assuming that the array begins at location 1002?   #include<stdio.h>   int main() {     int a[2][3][4] = { {1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2},                         {2, 1, 4, 7, 6, 7, 8, 9, 0, 0, 0, 0} };     printf("%u, %u, %u, %d\n", a, *a, **a, ***a);     return 0; }
    • A. 

      1002, 2004, 4008, 2

    • B. 

      2004, 4008, 8016, 1

    • C. 

      1002, 1002, 1002, 1

    • D. 

      Error

  • 15. 
    Find the missing statement ....to get the output - India #include<stdio.h> #include<string.h> int main() { char str[] = "XXXX\0\India\0"; printf("%s\n", str); return 0; }
    • A. 

      India

    • B. 

      \nIndia

    • C. 

      India\n

    • D. 

      \n

  • 16. 
    Find the missing  statement ..in order to get the address of prt #include <stdio.h>    int main()   {       int a=10;       int *ptr,XXXXXX;      ptr=&a;       pptr=&ptr; }
    • A. 

      **pptr

    • B. 

      *pptr

    • C. 

      *ptr

    • D. 

      **ptr

  • 17. 
    Find the missing statement in order to get output  4 #include<stdio.h>   int main()   {    char a[20];    int n=XXXXXX(a,"cbitt");    printf("value of n is %d",n);    return 0;}  
    • A. 

      Printf

    • B. 

      Sprintf

    • C. 

      Getchar

    • D. 

      Scanf

  • 18. 
    Find the missing statement in order to swap two number a and b a=XXXXX;    b=a-b;       a=a-b;
    • A. 

      A+b

    • B. 

      A-b

    • C. 

      B-a

    • D. 

      A*b

  • 19. 
    In the following code to find if a number is armstrong number or not..Find the missing statement #include<stdio.h>       #include<conio.h>       main()       {       int n,r,sum=0,temp;     clrscr(); / printf("enter the number=");       scanf("%d",&n);       temp=n;       while(n>0)       {       r=n%10;       sum=sum+(XXXXX);       n=n/10;       }       if(temp==sum)       printf("armstrong  number ");       else       printf("not armstrong number");       getch();  }    
    • A. 

      R*r*r

    • B. 

      R*r

    • C. 

      R

    • D. 

      R*r*r*

  • 20. 
    In order to get the same output twice find the missing statement #include <stdio.h>   int x = 0; void main() { int *ptr = &x; printf("%p\n", ptr); XXXX; printf("%p\n ", ptr); }
    • A. 

      X++;

    • B. 

      X+2;

    • C. 

      X+7;

    • D. 

      X-1;

  • 21. 
    In order to get output 0  Find the missing statement.. include <stdio.h> void main() { int x = 0; int *ptr = &x; printf("%d\n", XXX); }
    • A. 

      *ptr

    • B. 

      Ptr

    • C. 

      &ptr

    • D. 

      **ptr

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.