Tìm kiếm:
TRANG NHÀ
Giới thiệu VNEDU.ORG
Điều khoản và bản quyền
Liên lạc VNEDU
TRẮC NGHIỆM TRỰC TUYẾN
---Công Cụ:---
Soạn Biểu thức
Bảng màu HTML
Ký hiệu đặc biệt 01
Ký hiệu đặc biệt 02
Ký hiệu đặc biệt 03
Ký hiệu đặc biệt 04
Ký hiệu đặc biệt 05
Ký hiệu đặc biệt 06
Ký hiệu đặc biệt 07
Ký hiệu đặc biệt [Toán]
Tin Học   ||  Căn Bản    Văn Phòng    Hệ Thống - Mạng    Phần Mềm Ứng Dụng    Kỹ thuật số    Lập trình    SQL  

Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 45
Ngày làm bài: Hôm nay lúc 18:00:07 (Server time)
Số câu hỏi: 10.   Tổng điểm: 10
Yêu cầu hoàn thành: 60 phút.
Thời gian còn lại: 
Cỡ chữ câu hỏi:  Cỡ chữ đáp án:


1-
Point out the error in the program?
#include<stdio.h>

/* Assume there is a file called 'file.c' in c:\tc directory. */
int main()
{
    FILE *fp;
    fp=fopen("c:\tc\file.c", "r");    
    if(!fp) 
      printf("Unable to open file.");        

    fclose(fp);
    return 0;
}

  A - 
No error, No output.
  B - 
Program crashes at run time.
  C - 
Output: Unable to open file.
  D - 
None of above
2-
Point out the error/warning in the program?
#include<stdio.h>

int main()
{
    unsigned char ch;
    FILE *fp;
    fp=fopen("trial", "r");
    while((ch = getc(fp))!=EOF)
        printf("%c", ch);
    fclose(fp);
    return 0;
}

  A - 
Error: in unsigned char declaration
  B - 
Error: while statement
  C - 
No error
  D - 
It prints all characters in file "trial"
3-
Which of the following statement is correct about the program?
#include<stdio.h>

int main()
{
    FILE *fp;
    char ch;
    int i=1;
    fp = fopen("myfile.c", "r");
    while((ch=getc(fp))!=EOF)
    {
        if(ch == '\n')
            i++;
    }
    fclose(fp);
    return 0;
}

  A - 
The code counts number of characters in the file
  B - 
The code counts number of words in the file
  C - 
The code counts number of blank lines in the file
  D - 
The code counts number of lines in the file
4-
Which of the following statement is correct about the program?
#include<stdio.h>

int main()
{
    FILE *fp;
    char str[11], ch;
    int i=0;
    fp = fopen("INPUT.TXT", "r");
    while((ch=getc(fp))!=EOF)
    {
        if(ch == '\n' || ch == ' ')
        {
            str[i]='\0';
            strrev(str);
            printf("%s", str);
            i=0;
        }
        else
            str[i++]=ch;
    }
    fclose(fp);
    return 0;
}

  A - 
The code writes a text to a file
  B - 
The code reads a text files and display its content in reverse order
  C - 
The code writes a text to a file in reverse order
  D - 
None of above
5-
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))>0)
        {
            fputs(str, fptr);
            fputs("\n", fptr);
        }
        fclose(fptr);
    }
    return 0;
}

  A - 
The code copies the content of one file to another
  B - 
The code writes strings that are read from the keyboard into a file.
  C - 
The code reads a file
  D - 
None of above
6-
While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.
  A - 
True
  B - 
False
7-
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.
  A - 
True
  B - 
False
8-
Offset used in fseek() function call can be a negative number.
  A - 
True
  B - 
False
9-
We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()
  A - 
True
  B - 
False
10-
In a call to printf() function the format specifier %b can be used to print binary equivalent of an integer.
  A - 
True
  B - 
False
 
[Người đăng: Thành Lãm - ST]
Ghé thăm Kênh của Vị Sư "hai lần chết đi sống lại"
Tu Si Chau Soc Thon

https://www.youtube.com/channel/UCoyC9WTTVR-M3qpTKKEXGnQ

Chau Soc Thon Official Channel


Phong Bảo Official
Phong Bao Official
Xem Nhiều nhất
Trắc Nghiệm Pascal - Bài 20
Trắc Nghiệm ASP.NET - Bài 12
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 16
Trắc Nghiệm ASP.NET - Bài 01
Trắc Nghiệm ASP.NET - Bài 03
Trắc nghiệm C++ - Bài 18
Trắc Nghiệm C# - Bài 53
Trắc Nghiệm ASP.NET - Bài 02
Trắc Nghiệm C# - Bài 42
Trắc Nghiệm Java - Bài 01
Trắc Nghiệm ASP.NET - Bài 04
Trắc Nghiệm Pascal - Bài 22
Trắc Nghiệm ASP.NET - Bài 13
Trắc Nghiệm ASP.NET - Bài 09
Trắc Nghiệm ASP.NET - Bài 08
Trắc nghiệm PHP - Bài 01
Trắc Nghiệm ASP.NET - Bài 06
Trắc Nghiệm ASP.NET - Bài 11
Trắc Nghiệm ASP.NET - Bài 05
Trắc Nghiệm ASP.NET - Bài 23
Đề Xuất
Trắc Nghiệm ASP.NET (English) - Bài 11
Trắc Nghiệm Pascal - Bài 16
Trắc nghiệm Linux - Bài 59
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 34
Trắc Nghiệm Visual Basic - Bài 15
Trắc Nghiệm Java - Bài 39
Trắc Nghiệm Thiết Kế Web - Bài 15
Trắc Nghiệm C Sharp - Bài 30
Trắc Nghiệm Java - Bài 54
Trắc Nghiệm Java - Bài 55
Trắc Nghiệm ASP.NET (English) - Bài 30
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 29
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 68
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 18
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 13
Trắc Nghiệm Thiết Kế Web (English) - Bài 15
Trắc Nghiệm Java - Bài 45
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 18
Trắc nghiệm XML - Bài 26
Trắc Nghiệm C Sharp - Bài 10
Phát triển hệ thống: TRƯƠNG HỮU ĐỨC - Phiên bản 3.0 - © Copyright 2013 - 2024 - VNEDU.ORG

free counters