Sail E0 Webinar

MCQs

Total Questions : 64 | Page 4 of 7 pages
Question 31.


What will be the output of the program ?


#include<stdio.h>
int *check(static int, static int);
int main()
{
int *c;
c = check(10, 20);
printf("%d\n", c);
return 0;
}
int *check(static int i, static int j)
{
int *p, *q;
p = &i;
q = &j;
if(i >= 45)
return (p);
else
return (q);
}
  1.    10
  2.    20
  3.    Error: Non portable pointer conversion
  4.    Error: cannot use static for function parameters
 Discuss Question
Answer: Option D. -> Error: cannot use static for function parameters

No answer description available for this question. 


Question 32.


What will be the output of the program ?


#include<stdio.h>
int main()
{
char *str;
str = "%s";
printf(str, "K\n");
return 0;
}
  1.    Error
  2.    No output
  3.    K
  4.    %s
 Discuss Question
Answer: Option C. -> K

No answer description available for this question. 


Question 33.


What will be the output of the program ?


#include<stdio.h>
int main()
{
char str[20] = "Hello";
char *const p=str;
*p='M';
printf("%s\n", str);
return 0;
}
  1.    Mello
  2.    Hello
  3.    HMello
  4.    MHello
 Discuss Question
Answer: Option A. -> Mello

No answer description available for this question. 


Question 34.


What will be the output of the program If the integer is 4bytes long?


#include<stdio.h>
int main()
{
int ***r, **q, *p, i=8;
p = &i;
q = &p;
r = &q;
printf("%d, %d, %d\n", *p, **q, ***r);
return 0;
}
  1.    8, 8, 8
  2.    4000, 4002, 4004
  3.    4000, 4004, 4008
  4.    4000, 4008, 4016
 Discuss Question
Answer: Option A. -> 8, 8, 8

No answer description available for this question. 


Question 35.


What will be the output of the program ?


#include<stdio.h>
void fun(void *p);
int i;
int main()
{
void *vptr;
vptr = &i;
fun(vptr);
return 0;
}
void fun(void *p)
{
int **q;
q = (int**)&p;
printf("%d\n", **q);
}
  1.    Error: cannot convert from void** to int**
  2.    Garbage value
  3.    0
  4.    No output
 Discuss Question
Answer: Option C. -> 0

No answer description available for this question. 


Question 36.


What will be the output of the program ?


#include<stdio.h>
int main()
{
int x=30, *y, *z;
y=&x; /* Assume address of x is 500 and integer is 4 byte size */
z=y;
*y++=*z++;
x++;
printf("x=%d, y=%d, z=%d\n", x, y, z);
return 0;
}
  1.    x=31, y=502, z=502
  2.    x=31, y=500, z=500
  3.    x=31, y=498, z=498
  4.    x=31, y=504, z=504
 Discuss Question
Answer: Option D. -> x=31, y=504, z=504

No answer description available for this question. 


Question 37.


What will be the output of the program ?
What will be the output of the program ?


#include<stdio.h>
int main()
{
static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0;
}
  1.    ink
  2.    ack
  3.    ite
  4.    let
 Discuss Question
Answer: Option A. -> ink

No answer description available for this question. 


Question 38.

The operator used to get value at address stored in a pointer variable is


  1.    *
  2.    &
  3.    &&
  4.    ||
 Discuss Question
Answer: Option A. -> *

No answer description available for this question. 


Question 39.


What will be the output of the program ?


include<stdio.h>
int main()
{
int i=3, *j, k;
j = &i;
printf("%d\n", i**j*i+*j);
return 0;
}
  1.    30
  2.    27
  3.    9
  4.    3
 Discuss Question
Answer: Option A. -> 30

No answer description available for this question. 


Question 40.

A pointer is


  1.    A keyword used to create variables
  2.    A variable that stores address of an instruction
  3.    A variable that stores address of other variable
  4.    All of the above
 Discuss Question
Answer: Option C. -> A variable that stores address of other variable

No answer description available for this question. 


Latest Videos

Latest Test Papers