Time Left - 06:00 mins

UGC-NET EC 2017: C Programming & Language SpeedTest Quiz 12

Attempt now to get your rank among 111 students!

Question 1

#include<stdio.h>
void main()
{

    int a;
    char ch;
    int *ptr1,*ptr2; Position 1
   {
    int a;
    *ptr1=a;
   {
     int b;. Position 2
     ptr2=&b;
    }
    printf("%u",ptr2);. Position 3
    }
}
If free & consumed memory space ratio in position 1,2,3 are x1, x2, x3 respectively, which is right?

Question 2

Consider Integer takes 4 bytes memory space.
void show();
void view();
void main()
{
char A[1+sizeof(NULL)]=”programming”;
printf(“%s”,A);
view();
}
void view()
{
int *p;
*P=6;
printf(“%d”,*p);
show();
}
void show()
{
printf(“%x”,-5<<5);
}
What will be the output ?

Question 3

Consider Integer value takes 4 bytes memory space.
#define A 6
main()
{
printf(“The sum is %d”,f1()+f2());
}
void f1()
{
typedef int Arr[A];
Arr Arrr[10];
return sizeof(Arrr);
}
void f2()
{
printf(“gradeUp”);
}
What will be the output ?
The sum is __?__.

Question 4

int a;
main()
{
int k;
printf(“k=%d”, fun());
}
int fun()
{
if(sizeof(NULL)==0)
if(printf("2"))
a=6;
else
a=4;
return(a+ printf(“%d”,700));
}
What is correct option k= ?

Question 5

Consider the C program below.
#include <stdio.h> int *A, stkTop;
int stkFunc(int opcode, int val)
{
static int size=0, stkTop=0;
switch (opcode) {
case -1: size = val; break;
case 0: if (stkTop < size) A[stkTop++] = val; break; default: if (stkTop) return A[--stkTop];
}
return -1;
}
int main()
{
int B[20]; A = B; stkTop = -1;
stkFunc (-1, 10);
stkFunc ( 0, 5);
stkFunc ( 0, 10);
printf ("%d\n", stkFunc(1, 0) + stkFunc(1,0));
}
The value printed by the above program is ___________.
  • 111 attempts
  • 1 upvote
  • 1 comment
Apr 7ESE & GATE EC