Professional Documents
Culture Documents
# include "stdio.h"
main()
{
int size = 10;
int arr[size];
for ( i = 1 ; i <= size; i++)
{
scanf ("%d",&arr[i]);
printf ("\n%d", arr[i]);
}
}
answer : Compilation error
option : Runtime error
option : Garbage value
option : 10
# include "stdio.h"
main()
{
int i, j = 10, arrsize;
int arr[arrsize];
if ( j == 10)
arrsize = 20 ;
else
arrsize = 40 ;
for ( i = 0 ; i < arrsize; i++)
arr[i] = 100;
}
answer : Compilation error
option : Runtime error
option : 20
option : 40
include "stdio.h"
main()
{
int Array[6] = {1,2,3,4,5,6} ;
int i ;
for ( i = 0 ; i <= 5 ; i++)
printf ("%d",Array[i]) ;
}
answer : 123456
option : 1 2 3 4 5 6
option : Compilation error
option : Garbage value
# include "stdio.h"
main()
{
int a[]={2,3,4,5,6} ;
int i ;
for ( i = 5 ; i > 0; )
printf ("%d ",a[--i]) ;
}
answer : 6 5 4 3 2
option : 65432
option : Compilation error
option : Runtime error
# include "stdio.h"
main()
{
int arr(25), i ;
for ( i = 0 ; t <= 100; t++)
{
arr(i) = 100;
printf ("%d",arr(i)) ;
}
}
option : 25
option : 100
answer : Compilation error
option : Runtime error
# include "stdio.h"
main()
{
int a[ ] = {10,20,30,40,50} ;
int j ;
for ( j = 0 ; j < 5; j++)
{
printf ("%d",*a) ;
a++;
}
}
option : 10 20 30 40 50
option : 1020304050
answer : Compilation error
option : Runtime error
# include "stdio.h"
main()
{
float a[ ] = {13.24,1.5,1.5, 5.4,3.5} ;
float *j, *k;
j=a;
k=a+4 ;
j=j*2;
k=k/2 ;
printf ("%f%f",*j,*k) ;
}
answer : Compilation error
option : Runtime error
option : 13.24 1.5 1.5 5.4 3.5
option : Garbage error
# include "stdio.h"
main()
{
int arr[] ={0,1,2,3,4} ;
int i, *ptr;
for (ptr = &arr[0]; ptr <= &arr[4]; ptr++)
printf ("%d ",*ptr) ;
}
answer : 0 1 2 3 4
option : 01234
option : Compilation error
option : Runtime error
# include "stdio.h"
main()
{
int arr[] ={0,1,2,3,4} ;
int i, *ptr;
for (ptr = &arr[0], i = 0 ; i <= 4 ; i++)
printf ("%d",ptr[i]) ;
}
option : 0 1 2 3 4
answer : 01234
option : Compilation error
option : Runtime error
# include "stdio.h"
main()
{
int arr[] = { 0,1,2,3,4} ;
int i, *p;
for (p = arr, i = 0 ; p + i <= arr + 4 ; p++, i++)
printf ("%d ",*(p + i)) ;
)
option : 0 1 2 3 4
answer : 0 2 4
option : 01234
option : 024
# include "stdio.h"
main()
{
int arr[] = {0,2,4,6,8} ;
int i, *ptr;
for (ptr = arr + 4 ; ptr <= arr; ptr--)
printf ("%d ",*ptr) ;
}
answer : 8 6 4 2 0
option : 86420
option : 0 2 4 6 8
option : 02468
# include "stdio.h"
main()
{
float arr[] ={1.2,12,2.4,24,3.5,35} ;
int i ;
for ( i = 0 ; i <= 5; i++)
printf ("%.2f", arr[i]);
}
answer : 1.20 12.00 2.40 24.00 3.50 35.00
option : 1.2 12 2.4 24 3.5 35
option : Compilation error
option : Garbage value
# include "stdoi.h"
main()
{
static int a[]={2,3,4,5,6} ;
int i ;
for ( i = 5 ; i > 0; )
printf ("%d ",a[--i]) ;
}
option : 6 5 4 3 2
option : 65432
answer : Compilation error
option : Runtime error
# include "stdio.h"
main()
{
int n[25];
n[0] = 100;
n[24] = 200;
printf ("%d %d", *n, *(n + 24) + *( n + 0)) ;
}
answer : 100 300
option : 100 200
option : 200 300
option : Compilation error
instruction : null
Module 5
question : What is the value of var after executing the following program
#include "stdio.h"
#define var 5
int main()
{
int *ptrx;
ptrx = &var;
*ptrx = 10;
printf("%d\n", var);
return 0;
}
option : 5
option : 10
answer : Compilation error
option : Rubtime error
#include "stdio.h"
int main()
{
int x=15;
int *ptrx;
ptrx = &x;
*ptrx = 20;
printf("%d\n", x);
return 0;
}
option : 15
answer : 20
option : Compilation error
option : Runtime error
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 300. What
will be the value of ip after executing the following statements?
question : Assume variable x is stored at memory location 1000, y at memory 2000, and ip at memory 100. What
will be the value of y after executing the following statements?
int x, y, *ip;
x=5;y=10;
ip=&x;
y= *ip;
option : y =1000
answer : y = 5
option : y = 10
option : Runtime error
question : Assume variable x is stored at memory location 1000, y at memory 2000, and ip at memory 100. What
will be the value of y after executing the following statements?
int x, y, *ip;
x=5;y=10;
ip=&y;
y= *ip;
option : y=1000
option : y=5
answer : y=10
option : Runtime error
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip;
x=1;y=2;
ip=&x;
y= ip;
answer : y=100
option : y = 1
option : y=2
option : Runtime error
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ip2;
option : y=100
answer : y=200
option : y=1
option : y=2
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip1,*ip2;
x=10;y=2;
ip1=&x;
ip2=&y;
y= *ip1;
option : y=100
option : y=1000
option : y=200
answer : y=10
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ++(*ip2);
option : y=1
option : y=2
answer : y=3
option : y=100
#include "stdio.h"
int main()
{
int x=15;
int *ptrx;
ptrx = &x;
*ptrx = 20;
printf("%d\n", x);
return 0;
}
option : 15
answer : 20
option : Compilation error
option : Runtime error
question : Assume variable x is stored at memory location 1000, y at memory 2000, and ip at memory 3000.
What will be the value of ip after executing the following statements?
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip;
x=1;y=2;
ip=&x;
y= *ip;
option : y =100
answer : y = 1
option : y = 2
option : Runtime error
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip;
x=1;y=2;
ip=&y;
y= *ip;
option : y=100
option : y=1
answer : y=2
option : Runtime error
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip;
x=1;y=2;
ip=&x;
y= ip;
answer : y=100
option : y = 1
option : y=2
option : Runtime error
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ip2;
option : y=100
answer : y=200
option : y=1
option : y=2
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip1,*ip2;
x=10;y=2;
ip1=&x;
ip2=&y;
y= *ip1;
option : y=100
option : y=1000
option : y=200
answer : y=10
question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?
int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ++(*ip2);
option : y=1
option : y=2
answer : y=3
option : y=100
ptr = &b;
a=(char *) ptr;
printf("%d ", b);
}
What is the output of the code above ?
option : Address of a
option : 9
answer : compilation error
option : runtime error
ptr = &b;
a= ptr;
printf("%d ", b);
}
instruction : null
Module 6
main()
{
char fname[10], sname[10];
strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf("%s", memcpy(fname, sname,1));
}
main()
{
char fname[10], sname[10];
strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf("%s", memcpy(fname, sname,2));
}
main()
{
char fname[10], sname[10];
strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf(" %d", strcmpi(fname, sname));
}
What is the output of the code above?
answer : 0
option : 1
option : -1
option : No output
main()
{
char fname[10], sname[10];
strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf(" %d", strcmp(fname, sname));
}
What is the output of the code above?
option : 0
option : 1
answer : -1
option : No output
return 0;
}
What is the ouytput of the code above?
option : 12
answer : 12.000000
option : Compilation error
option : Garbage value
question : .......... fucntion is used to clear the buffer attached to the standard input.
answer : fflush()
option : clear()
option : exit()
option : dump()
instruction : null
Module 7