Functions And Pointer - C Programming MCQ

31. What is the output of this program?

#include <stdio.h>
void main()
{
int arr[3] = {1, 2, 3};
int *ptr = arr;
int **temp = &ptr ; 
printf("%p %p", *temp, arr);
}

A. Same Address
B. Different Address
C. 1 2
D. 2 3

View Answer


32. The pointer ptr points to which string?

char *ptr;
char myString[]="letsfind";
ptr=myString
ptr+=5;

A. find
B. ind
C. letsf
D. f

View Answer


33. What will be the output ?

void main()
{
char far *farther, *farthest;
printf("%d %d", sizeof(farther), sizeof(farthest));
}

A. 4 2
B. 2 2
C. 4 4
D. 2 4

View Answer


34. What is the output of this program?

#include <stdio.h>
void test(int * , int *);
void main()
{
  int a = 5 , b = 6;
  test(&a,&b);
  printf("%d %d",a,b);
}
void test(int *p, int *q)
{
  *p = *p * *q;
  *q = *p + *q;
  *p = *p - *q;
}

A. -6 36
B. 6 36
C. 36 6
D. -42

View Answer


35. Will the program compile?

#include<stdio.h>
int main()
{
    char str[5] = "Letsfind";
    return 0;
}

A. TRUE
B. FALSE
C. May Be
D. Can't Say

View Answer


36. Are the three declarations char **apple, char *apple[], and char apple[][] same?

A. TRUE
B. FALSE
C. May Be
D. Can't Say

View Answer


37. Is the NULL pointer same as an uninitialised pointer?

A. Yes
B. No
C. May Be
D. Can't Say

View Answer


38. Which of the following statements correct about k used in the below statement?

char ****k;

A. k is a pointer to a pointer to a pointer to a char
B. k is a pointer to a pointer to a pointer to a pointer to a char
C. k is a pointer to a char pointer
D. k is a pointer to a pointer to a char

View Answer


39. Is there any difference between the following two statements?

char *p=0;
char *t=NULL;

A. Yes
B. No
C. May Be
D. Can't Say

View Answer


40. Is this a correct way for NULL pointer assignment?

int i=0;
char *q=(char*)i;

A. Yes
B. No
C. May Be
D. Can't Say

View Answer







Also check :


Discussion


* You must be logged in to add comment.