Professional Documents
Culture Documents
//
1)
Consider the following program
#include <stdio.h>
void main()
{
int y,z;
int x=y=z=10;
int f=x;
float ans=0.0;
f=x*y;
ans=x/3.0 + y/3;
printf("%d,%.2f",f,ans);
}
/*
*/
//
2)
Study the following code carefully
#include <stdio.h>
void main(void);
double dbl=20.4530,d=4.5710,dblvar3;
void main()
{
double dbfn(void);
dblvar3=dbfn();
printf("%.2f\t%.2f\t%.2f\n",dbl,d,dblvar3);
}
double dbfn(void)
{
double d,dblvar3;
dbl=d=dblvar3=4.5;
return(dbl+d+dblvar3);
}
/*
program will be
29.52;
13.50;
29.52;
13.50; */
//
3)
Consdier the following program
#include <stdio.h>
int SumElement(int *,int);
void main(void)
{
int x[10];
int i=10;
for(;i;)
{
i--;
*(x+i)=i;
}
printf("%d",SumElement(x,10));
}
int SumElement(int array[],int size)
{
int i=0;
float sum=0;
for(;i<size;i++)
sum+=array[i];
return sum;
}
/*
}
printf("Sum = %d",sum);
}
int newval(int x)
{
static int div = 1;
return (x/div++);
}
/*
a)
b)
c)
d)
*/
It will
It will
It will
None of
float y;
}u1;
u1=(union u)s1;
printf("%d and %f",u1.x,u1.y);
}
/* What will this program point ?
a)
b)
c)
d)
25 and 45.00
Produce a compilation error
45 and 45.00
Produce a runtime error */
printf("Hello! \t");
printf("Welcome \t");
printf("To All \t");
printf("\n");
}
}
/* If the value input for the variable c is 10, what will be the output
of the program ?
a) The program will generate a compile time error as there is no break
statement for the various case choices.
b) The program will print Hello!
c) The program will print Welcome
To All
d) None of the above */
// 16)
#include <stdio.h>
// print the sum of series 1/5 + 1/4 + ...
static int i=5;
void main(void)
{
int sum = 0;
do
{
sum+=(1/i);
}while (0 < i--);
}
/*
a)
b)
c)
Hi
These are some of the questions asked in the Wip.Info. test.
Written : Mainly OS, Datastructures, C and CO .
Answers : All the answers which iam giving here may not right. These are
just what I wrote there.
1. On Deadlock : Trivial
2. CPU Utilization:
given
CPU time
paging
I/O
Status: OR
Hi
These are some of the questions asked in the Wip.Info. test.
Written : Mainly OS, Datastructures, C and CO .
Answers : All the answers which iam giving here may not right. These are
just what I wrote there.
1. On Deadlock : Trivial
2. CPU Utilization:
given
CPU time
paging
I/O