Академический Документы
Профессиональный Документы
Культура Документы
Assessment 1 Questions
void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf("EXAM");
}
}
1) XAM is printed
2) exam is printed
3) Compiler Error
4) Nothing is printed
#include<stdio.h>
void main()
{
int s=0;
while(s++<10)
{
if(s<4 && s<9)
continue;
printf("\n%d\t",s);
}
}
1) 1 2 3 4 5 6 7 8 9
2) 1 2 3 10
3) 4 5 6 7 8 9 10
4) 4 5 6 7 8 9
#include <stdio.h>
void main()
{
int i=3,*j,**k;
j=&i;
k=&j;
printf("%d%d%d",*j,**k,*(*k));
}
1) 444
2) 000
3) 333
4) 433
1) float ptr;
2) float *ptr;
3) *float ptr;
4) None of the above
main()
{
struct
{
int i;
}xyz;
(*xyz)->i=10;
printf("%d",xyz.i);
}
1) program will not compile
2) 10
3) god only knows
4) address of I
#include<stdio.h>
void swap(int&, int&);
C Test
void main()
{
int a = 10,b=20;
swap (a++,b++);
printf("\n%d\t%d\t",a, b);
}
void swap(int& x, int& y)
{
x+=2;
y+=3;
}
1) 14, 24
2) 11, 21
3) 10, 20
4) Error
#include<stdio.h>
void main()
{
int a=0,b=0;
a = (b = 75) + 9;
printf("\n%d, %d",a, b);
}
1) 75, 9
2) 75, 84
3) 84, 75
4) None of these options
# include<stdio.h>
# define a 10
main()
{
printf("%d..",a);
foo();
printf("%d",a);
}
void foo()
{
#undef a
#define a 50
}
C Test
1) 10..10
2) 10..50
3) Error
4) 0
main()
{
char thought[2][30]={"Don`t walk in front of me..","I am not follow"};
printf("%c%c",*(thought[0]+9),*(*(thought+0)+5));
}
1) k k
2) Don`t walk in front of me
3) I may not follow
4) K
1) Only a
2) Only b
3) Both a and b
4) None of these options
x = "HELLO";
y = myFunc (x);
printf ("y = %s \n", y);
return 0;
}
15. What will print when the sample code above is executed?
e. y = HELLO
f. y = ELLO
g. y = LLO
h. y = LO
i. x=O
16. scanf function revives 2 parameter
j. formatted string and variables separated by comma
k. formatted string and address of variables separated by comma
l. a and b both are true
m. a and b both are false