AI智能整理导入 AI智能整理导入
×
首页 题库中心 c语言程序设计题库 题目详情
CA85E835B92000012B50FB49F93816B5
c语言程序设计题库
1,073
单选题

有以下程序
void main(void)
{
int k=1;
switch(k)
{
default: break;
case 1: k++;
case 2:
case 3: k++;
}
printf("%d\n", k) ;
}
结果为( )

A
3
B
1
C
2
D
4

答案解析

正确答案:A

解析:

顺序程序设计
c语言程序设计题库

扫码进入小程序
随时随地练习

相关题目

单选题

若以“a + ”方式打开一个已存在的文件, 则以下叙述正确的是( ) 。

单选题

当顺利执行了文件关闭操作时, fclose 函数的返回值是( ) 。

单选题

已知函数的调用形式: fread ( buffer , size , count ,fp ) ; 其中buffer 代表的是( ) 。

单选题

若有以下定义和说明:
# include “stdio . h”
struct std
{ char num [ 6 ] ;
char name [ 8 ] ;
float mark [ 4 ] ;
} ss[ 30 ];
FILE * fp ;
设文件中以二进制形式存有10 个班的学生数据, 且已正确打开, 文件指针定位于文件开头。 若要从文件中读30 个学生的数据放入ss 数组中, 以下不能实现此功能的语句是( ) 。

单选题

fscanf 函数的正确调用形式是( )。

单选题

fwrite 函数的一般调用形式是( )。

单选题

fgetc 函数的作用是从指定文件读入一个字符, 该文件的打开方式必须是( )。

单选题

若调用fputc函数输出字符成功, 则其返回值是( )。

单选题

设有以下结构体类型:
struct st
{ char name [ 8 ] ;
int num ;
float s[ 4 ] ;
} student[ 50 」 ;
并且结构体数组student 中的元素都已有值, 若要将这些元素写到硬盘文件fp 中, 以下不正确的形式是( )。

单选题

阅读以下程序及对程序功能的描述, 其中正确的描述是( ) 。
# include
main ( )
{
FILE *in , *out ;
char ch , infile [ 10 ] , outfile [ 10 ] ;
printf (“Enter the infile name : \ n” ) ;
scanf (“ % s”, infile ) ;
printf ( “Enter the outfile name : \n” ) ;
scanf ( " % s " , outfile ) ;
if ( ( in = fopen ( infile ,”r " ) ) = = NULL )
{
printf ( “cannot open infile \ n”) ;
exit ( 0 ) ;
}
if ( ( out = fopen ( outfile , “w” ) ) ==NULL )
{
printf (”cannot open outfile \n”) ;
exit ( 0 ) ;
}
while ( !feof (in))fputc(fgetc(in), out) ;
fclose ( in ) ;
fclose ( out ) ;
}

关闭
专为自学备考人员打造
试题通
自助导入本地题库
试题通
多种刷题考试模式
试题通
本地离线答题搜题
试题通
扫码考试方便快捷
试题通
海量试题每日更新
试题通
欢迎登录试题通
可以使用以下方式扫码登陆
试题通
使用APP登录
试题通
使用微信登录
xiaochengxu
联系电话:
400-660-3606
xiaochengxu