1. We should not read after a write to a file
without an intervening call to fflush(), fseek() or rewind() "TRUE/FALSE" ?
2. If the program (myprog) is run from the command
line as myprog 1 2 3 , What would be the output?
#include<stdio.h>
int main(int argc, char *argv[]){
int i;
for(i=0;i<argc;i++)
printf("%s",argv[i]);
return 0;
}
a) 1 2 3
b) C:\MYPROG.EXE 1 2 3
c) MYP
d) None of the above
3. If the following program (myprog) is run from
the command line as myprog 1 2 3, what would be the output?
#include<stdio.h>
int main(int argc, char *argv[]){
int i,j=0;
for(i=0;i<argc;i++)
j=j+ atoi(argv[i]);
printf("%d",j);
return 0;
}
a) 1 2 3
b) 6
c) error
d) "123"
4. If the following program (myprog) is run from
the command line as :
myprog monday tuesday wednesday thursday
What would be the output?
#include<stdio.h>
int main(int argc, char *argv[]){
while(--argc <0)
printf("%s",*++argv);
return 0;
}
a) myprog monday tuesday wednesday thursday
b) monday tuesday wednesday thursday
c) myprog tuesday thursday
d) None of the above
No comments:
Click Here To add Comment
Post a Comment
Blogger Widgets