Sail E0 Webinar

MCQs

Total Questions : 27 | Page 3 of 3 pages
Question 21. Find the output of the following program.
void main()
{
printf("%d, %d", sizeof(int *), sizeof(int **));
}
  1.    2, 0
  2.    0, 2
  3.    2, 2
  4.    2, 4
  5.    4, 4
 Discuss Question
Answer: Option C. -> 2, 2
Question 22. Find the output of the following program.
void main()
{
int i=10; /* assume address of i is 0x1234ABCD */
int *ip=&i;
int **ipp=&&i;
printf("%x,%x,%x", &i, ip, *ipp);
}
  1.    0x1234ABCD, 0x1234ABCD, 10
  2.    0x1234ABCD, 0x1234ABCD, 0x1234ABCD
  3.    0x1234ABCD, 10, 10
  4.    Syntax error
  5.    Runtime error
 Discuss Question
Answer: Option D. -> Syntax error
Question 23. Which of the following statements are true after execution of the program.
void main()
{
int a[10], i, *p;
a[0] = 1;
a[1] = 2;
p = a;
(*p)++;
}
  1.    a[1] = 3
  2.    a[0] = 2
  3.    a[1] = 2
  4.    a[0] = 3
  5.    Compilation error
 Discuss Question
Answer: Option B. -> a[0] = 2
Question 24. What is the base data type of a pointer variable by which the memory would be allocated to it?
  1.    int
  2.    float
  3.    No data type
  4.    Depends upon the type of the variable to which it is pointing.
  5.    unsigned int
 Discuss Question
Answer: Option E. -> unsigned int
Question 25. What would be the output for the following Turbo C code?
#include
void main()
{
int a[]={ 1, 2, 3, 4, 5 }, *p;
p=a;
++*p;
printf("%d ", *p);
p += 2;
printf("%d", *p);
}
  1.    2 4
  2.    3 4
  3.    2 2
  4.    2 3
  5.    3 3
 Discuss Question
Answer: Option D. -> 2 3
Question 26. Char* myfunc(char *ptr)
{
ptr+=3;
return(ptr);
}
void main()
{
char *x, *y;
x = "EXAMVEDA";
y = myfunc(x);
printf("y=%s", y);
}
What will be printed when the sample code above is executed?
  1.    y=EXAMVEDA
  2.    y=AMVEDA
  3.    y=MVEDA
  4.    y=VEDA
  5.    y=EDA
 Discuss Question
Answer: Option C. -> y=MVEDA
Question 27. Char *ptr;
char myString[] = "abcdefg";
ptr = myString;
ptr += 5;
what string does ptr point to in the sample code above?
  1.    fg
  2.    efg
  3.    defg
  4.    cdefg
  5.    bcdefg
 Discuss Question
Answer: Option A. -> fg

Latest Videos

Latest Test Papers