Professional Documents
Culture Documents
1.
if file contents following data in sunbeam.txt
[PUNE KARAD SATARA MUMBAI]
#include <stdio.h>
int main( void )
{
FILE *fp=NULL; char c[1024];
fp = fopen("Sunbeam.txt", "r");
fseek(fp, 0, SEEK_END);
fseek(fp, -9L, SEEK_CUR);
fgets(c, 5, fp);
puts(c);
return 0;
}
A. RA MUM
B. ARA
C. TARA M
D. run time error
Answer: D
2.
if file contents following data in sunbeam.txt
[PUNE KARAD SATARA MUMBAI]
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fptr=fopen("sunbeam.txt","r"); char ch;
while(!feof(fptr))
{
printf("%c",fgetc(fptr));
fseek(fptr,-1,SEEK_CUR);
}
fclose(fptr);
return 0;
}
Answer: B
3.
By default stream stdout is
A. Unbuffered
B. Fully Buffered
C. Line Buffered
D. None of these
Answer: A
4.
A mode which is used to open an existing file for both
reading and writing
A. "w"
B. "w+"
C. "r+"
D. "wb+"
Answer: C
5.
Which of the following fuinction is most appropriate
for storing the data type of any data type?
A. puts()
B. fprintf()
C. fwrite()
D. All of the above
Answer: C
A.-3,-4
B.-1,-6
C.-2,-6
D.-2,-4
Answer :C
7.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int num1=2;
int result=num1<<3;
if(result & num1)
printf("True");
else
printf("false");
return 0;
}
A. True
B. false
C. ERROR
D. Abnormal terminate
Answer: B
A. 16 0 1 40
B. 8 12 3 30
C. 16 1 1 10
D. 16 0 10 30
Answer: A
9.
#include <stdio.h>
int main(void)
{
int i=32,j=65,k;
k = j ^ 32;
printf(" k=%d",k);
k=j<<2;
printf(" k=%d",k);
k=i>>5;
printf(" k=%d",k);
return 0;
}
Answer: B
Answer: B
11.
#include <stdio.h>
int main(void)
{
int num = 12;
int j=0;
while (num>>=j)
{
printf("%d,%d ",num,j);
j++;
}
return 0;
}
Answer: A
A. Test1
B. Test2
C. No output
D. Abnormal termination
Answer: B
13.
#include <stdio.h>
int main(void)
{
int a,b,c;
a=5;
b=10;
c=printf("%d\0",b) + b++;
printf(" %d",c);
return 0;
}
A.11 12
B.10 12
C.12 12
D.Compile time error
Answer: B
A.12
B.11
C.10
D.run time error
Answer: D
15.
#include <stdio.h>
int main(void)
{
printf("\\ \? Test \0 Hello \n");
return 0;
}
Answer:-B
#include <stdio.h>
int main(void)
{
printf("\nC programming Language\nDennis Ritchie\t\n");
printf("\n\tSunbeam\rpune\n");
return 0;
}
A.
C programming Language
Dennis Ritchie
Sunbeam pune
B.
C programming Language
Dennis Ritchie
Sunbeam pune
C.
C programming Language
Dennis Ritchie
pune Sunbeam
D.
C programming Language Dennis Ritchie
pune Sunbeam
Answer: C