Input / Output - Find Output of Program Multiple Questions and Answers.




1.What will be the output of the program ?
A. char *str = "char *str = %c%s%c; main(){ printf(str, 34, str, 34);}"; main(){ printf(str, 34, str, 34);}
B. char *str = %c%s%c; main(){ printf(str, 34, str, 34);}
C. No output
D. Error in program

2.If the file 'source.txt' contains a line "Be my friend" which of the following will be the output of below program?
A. friend
B. frien
C. end
D. Error in fseek();

3.What will be the output of the program?
A. 3.00
B. 3.15
C. 3.2
D. 3

4.What will be the output of the program?
A. A
B. B
C. C
D. D

5.What will be the output of the program?
#include<stdio.h>
int main()
{
    FILE *fp;
    unsigned char ch;
     /* file 'abc.c' contains "This is PakMcqs" */
    fp=fopen("abc.c", "r");
    if(fp == NULL)
    {
        printf("Unable to open file");
        exit(1);
    }
    while((ch=getc(fp)) != EOF)
        printf("%c", ch);

    fclose(fp);
    printf("\n", ch);
    return 0;
}
A. This is PakMcqs
B. This is
C. Infinite loop
D. Error

»



Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers