1. MDSU Examination 2017
C Programming – Solution (Section A)
1. What will be the output of
x=101;
x=x>>2<<2;
printf(“%d”,x);
Ans: 100
2. Write down appropriate c statement for the following formula:
Ans: x=((a1*b1))+(a2*b2)/((c1+c2)*d);
3. What will be the value of following expression:
‘A’+’9’
Ans: 122
4. Write down the c statement to calculate percentage where three subjects eng, hindi,,
maths and total are of int type and percentage is of float. Max marks for each subject
are 100.
Ans:
void main()
{
int eng, hindi, maths, total;
float percentage;
clrscr();
eng=80;
hindi=90;
maths=57;
total=eng+hindi+maths;
percentage=(float)(total)*100/300;
printf("English::%dn",eng);
printf("Hindi::%dn",hindi);
printf("Maths::%dn",maths);
printf("percentage is::%.2f",percentage);
getch();
}
2. 5. What will be the output of
int x=0;
if(x=0)
{
Printf(“Hello”);
}
else
{
Printf(“Hey”);
}
Ans: Hey
6. What happen when a variable is declared as register variable but register memory is not
available?
Ans: Register variable store in main memory.
7. Create a boolen data type in C, which will accept true and false value.
True =1;
False= 0;
Ans: enum Boolean {false =0, true=1);
8. Define structure?
Ans: Structure is a user define data type used to define structure of a particular
program. It is a collection of heterogeneous type of data.
struct
{
int roll_no;
char name[20];
char clas[5];
};
9. What is global variable?
Ans: Global variables are defined outside a function, usually on top of the program.
Global variables hold their values throughout the lifetime of your program and they can
be accessed inside any of the functions defined for the program.
10. What do you mean by following statement?
int *x[10];
Ans: Array of Pointer with 10 dimension.