Q.1

stderr, stdin, stdout are FILE pointers

  • Yes
  • No
Q.2

What will be the content of 'file.c' after executing the following program?

#include<stdio.h>

int main()
{
    FILE *fp*fp    fp1=fopen("file.c", "w");
    fp2=fopen("file.c", "w");
    fputc('A', fp1);
    fputc('B', fp2);
    fclose(fp1);
    fclose(fp2);
    return}
  • B
  • A
    B
  • B
    B
  • Error in opening file 'file1.c'
Q.3

Point out the error in the program?

#include<stdio.h>
#include<stdlib.h>

int main()
{
    unsigned char;
    FILE *fp;
    fp=fopen("trial", "r");
    if(!fp)
    {
        printf("Unable to open file");
        exit(1);
    }
    fclose(fp);
    return
}
  • Error: in unsigned char statement
  • Error: unknown file pointer
  • No error
  • None of above
Q.4

Which of the following statement is correct about the program?

#include<stdio.h>

int main()
{
    FILE *fp;
    char ch;
    int i=
    fp = fopen("myfile.c", "r");
    while((ch=getc(fp))!=EOF)
    {
        if(ch == '\n')
            i++;
    }
    fclose(fp);
    return
}
  • The code counts number of characters in the file
  • The code counts number of words in the file
  • The code counts number of blank lines in the file
  • The code counts number of lines in the file
Q.5

While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.

  • True
  • False
Q.6

A file written in text mode can be read back in binary mode.

  • Yes
  • No
Q.7

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int k=
    printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE");
    return
}
  • k == 1 is TRUE
  • 1 == 1 is TRUE
  • 1 == 1 is FALSE
  • K == 1 is FALSE
Q.8

Point out the error in the program?

#include<stdio.h>

int main()
{
    char ch;
    int i;
    scanf("%c", &i);
    scanf("%d", &ch);
    printf("%c %d", ch, i);
    return
}
  • Error: suspicious char to in conversion in scanf()
  • Error: we may not get input for second scanf() statement
  • No error
  • None of above
Q.9

Which of the following statement is correct about the program?

#include<stdio.h>

int main()
{
    FILE *fp;
    char str[11], ch;
    int i=
    fp = fopen("INPUT.TXT", "r");
    while((ch=getc(fp))!=EOF)
    {
        if(ch == '\n' || ch == ' ')
        {
            str[i]='\0';
            strrev(str);
            printf("%s", str);
            i=
        }
        else
            str[i++]=ch;
    }
    fclose(fp);
    return
}
  • The code writes a text to a file
  • The code reads a text files and display its content in reverse order
  • The code writes a text to a file in reverse order
  • None of above
Q.10

A text stream is an ordered sequence of characters composed into lines, each line consisting of zero or more characters plus a terminating new-line character.

  • True
  • False
Q.11

What will be the output of the program ?

#include<stdio.h>

int main()
{
    printf("%c\n", ~('C'*-1));
    return}
  • A
  • B
  • C
  • D
Q.12

Will the following program work?

#include<stdio.h>

int main()
{
    int n=    printf("n=%*d\n", n, n);
    return}
  • Yes
  • No
Q.13

What will be the output of the program ?

#include<stdio.h>
char *str = "char *str = %c%s%c; main(){ printf(str,str, 34);}";

int main()
{
    printf(str,str, 34);
    return}
  • char *str = "char *str = %c%s%c; main(){ printf(str, 34, str, 34);}"; main(){ printf(str, 34, str, 34);}
  • char *str = %c%s%c; main(){ printf(str, 34, str, 34);}
  • No output
  • Error in program
Q.14

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int a=
    printf("%1d\n", a);
    return
}
  • 1250
  • 2
  • 50
  • 250
Q.15

Point out the error in the program?

#include<stdio.h>

int main()
{
    FILE *fp;
    fp=fopen("trial", "r");
    fseek(fp, "20", SEEK_SET);
    fclose(fp);
    return}
  • Error: unrecognised Keyword SEEK_SET
  • Error: fseek() long offset value
  • No error
  • None of above
Q.16

Point out the correct statements about the program?

#include<stdio.h>

int main()
{
    FILE *fptr;
    char str[80];
    fptr = fopen("f1.dat", "w");
    if(fptr == NULL)
        printf("Cannot open file");
    else
    {
        while(strlen(gets(str))>
        {
            fputs(str, fptr);
            fputs("\n", fptr);
        }
        fclose(fptr);
    }
    return
}
  • The code copies the content of one file to another
  • The code writes strings that are read from the keyboard into a file.
  • The code reads a file
  • None of above
Q.17

Offset used in fseek() function call can be a negative number.

  • True
  • False
Q.18

What will be the output of the program ?

#include<stdio.h>

int main()
{
    FILE *fp;
    unsigned char ch;
     /* file 'abc.c' contains "This is IndiaBIX " */
    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
}
  • This is IndiaBIX
  • This is
  • Infinite loop
  • Error
Q.19

Can we specify a variable filed width in a scanf() format string?

  • Yes
  • No
Q.20

What does fp point to in the program ?

#include<stdio.h>

int main()
{
    FILE *fp;
    fp=fopen("trial", "r");
    return
}
  • The first character in the file
  • A structure which contains a char pointer which points to the first character of a file.
  • The name of the file.
  • The last character in the file.
0 h : 0 m : 1 s