Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.What will be output of following program? #include<stdio.h> int main(){ int a

ID: 3538295 • Letter: 1

Question

1.What will be output of following program?

#include<stdio.h>

int main(){

   int a = 320;

   char *ptr;

   ptr =( char *)&a;

   printf("%d ",*ptr);

   return 0;

}

(A) 2       (B) 320 (C) 64     (D) Compilation error         (E) None of above                              

2.What will be output of following program?

#include<stdio.h>

#include<conio.h>

int main(){

   void (*p)();

   int (*q)();

   int (*r)();

   p = clrscr;

   q = getch;

   r = puts;

(*p)();

(*r)("cques");

(*q)();

return 0;

}

(A) NULL              (B) cques               (C) c       (D) Compilation error         (E) None of above

3.What will be output of following program?

#include<stdio.h>

int main(){

   int i = 3;

   int *j;

   int **k;

   j=&i;

   k=&j;

   printf("%u %u %d ",k,*k,**k);

   return 0;

}

(A) Address, Address, 3      (B) Address, 3, 3 (C) 3, 3, 3              (D) Compilation error         (E) None of above

4.What will be output of following program?

#include<stdio.h>

int main(){

   char far *p =(char far *)0x55550005;

   char far *q =(char far *)0x53332225;

   *p = 80;

   (*p)++;

   printf("%d",*q);

   return 0;

}

(A) 80     (B) 81     (C) 82     (D) Compilation error         (E) None of above                              

5.What will be output of following program?

#include<stdio.h>

#include<string.h>

int main(){

char *ptr1 = NULL;

char *ptr2 = 0;

strcpy(ptr1," c");

strcpy(ptr2,"questions");

printf(" %s %s",ptr1,ptr2);

return 0;

}

(A) c questions     (B) c (null)             (C) (null) (null)      (D) Compilation error                        

(E) None of above

6.What will be output of following program?

#include<stdio.h>

int main(){

int huge *a =(int huge *)0x59990005;

int huge *b =(int huge *)0x59980015;

if(a == b)

printf("power of pointer");

else

printf("power of c");

return 0;

}

(A) power of pointer            (B) power of c      (C) power of cpower of c   (D) Compilation error        

(E) None of above                              

7.What will be output of following program?

#include<stdio.h>

#include<string.h>

int main(){

register a = 25;

int far *p;

p=&a;

printf("%d ",*p);

return 0;

}

(A) 25     (B) 4       (C) Address           (D) Compilation error         (E) None of above

8.What will be output of following program?

#include<stdio.h>

#include<string.h>

int main(){

char far *p,*q;

printf("%d %d",sizeof(p),sizeof(q));

return 0;

}

(A) 2 2    (B) 4 4    (C) 4 2    (D) 2 4    (E) None of above                              

9.What will be output of following program?

#include<stdio.h>

int main(){

int a = 10;

void *p = &a;

int *ptr = p;

printf("%u",*ptr);

return 0;

}

(A) 10     (B) Address           (C) 2       (D) Compilation error         (E) None of above

10.What will be output of following program?

#include<stdio.h>

#include<string.h>

int main(){

int register a;

scanf("%d",&a);

printf("%d",a);

return 0;

}

//if a=25

(A) 25     (B) Address           (C) 0       (D) Compilation error         (E) None of above

Explanation / Answer

1)d

2)a

3)c

4)c

5)b

6)a

7)d

8)d

9)a

10)c

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote