Similar documents
,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : : : /16 : : 96 : : : ISBN 7

新版 明解C言語入門編

C/C++ - 文件IO

新・解きながら学ぶC言語

新・明解C言語入門編『索引』

nooog

CC213

C 1

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

プログラムの設計と実現II

FY.DOC

_汪_文前新ok[3.1].doc

C/C++ - 函数

新版 明解C++入門編

C/C++ - 字符输入输出和字符确认

C/C++语言 - C/C++数据

Ps22Pdf

Ps22Pdf

C/C++ - 字符串与字符串函数

C/C++程序设计 - 字符串与格式化输入/输出

CC213

C/C++ 语言 - 循环

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit

C C

C

四川省普通高等学校

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;

C/C++ - 数组与指针

C/C++语言 - 分支结构

PowerPoint プレゼンテーション

C

epub 33-8

. (A) (B) (C) A (D) (E). (A)(B)(C)(D)(E) A

C/C++语言 - 运算符、表达式和语句

2015年计算机二级(C语言)模拟试题及答案(四)

C/C++ - 结构体、共用体、枚举体

Microsoft Word - 第3章.doc

内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2

untitled

untitled

3.1 num = 3 ch = 'C' 2

2 12

立 志 于 打 造 最 贴 近 考 生 实 际 的 辅 导 书 计 算 机 考 研 之 数 据 结 构 高 分 笔 记 率 辉 编 著 周 伟 张 浩 审 核 讨 论 群 :

untitled

untitled

untitled

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

Microsoft Word - CPE考生使用手冊 docx

c_cpp

但 洋 糖 最 终 乘 船 溯 江 而 上, 再 加 上 民 国 初 年 至 抗 战 前 夕 二 十 余 年 间, 四 川 接 连 不 断 遭 受 水 灾 旱 灾 地 震, 平 均 每 月 爆 发 两 次 军 阀 混 战, 乡 村 遭 受 极 大 破 坏,( 赵 泉 民,2007) 农 村 经 济

第5章修改稿

Microsoft PowerPoint - 20-string-s.pptx

数据结构与算法 - Python基础

全国计算机技术与软件专业技术资格(水平)考试

untitled

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

C++ 程式設計

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco

Chapter12 Derived Classes

科学计算的语言-FORTRAN95

标题

全台灣路邊攤美食清單.doc

untitled

Microsoft Word 年9月二级C真卷.doc


( ) A B C D ( ) A B C D A B C D A B C D A 8750 B C 6250 D 5000 A B C D A B C D

51 C 51 isp 10 C PCB C C C C KEIL

zt

华恒家庭网关方案

新・解きながら学ぶJava

untitled

untitled

列 出 所 有 的 非 負 整 數 解, 係 數 越 大 者 越 先 決 定, 故 先 決 定 z, 再 決 定 y, 最 後 決 定 x, 故 有 = 8 ( 種 ) x y z

! # % % & # # % #!& % &# % &# % % % # %& ( (!& (! & & % % #!! ) %&! *& % %! % %!! # % %!! %*!& % &# % &# ) ) ( % # # ) % ( (!& (! (!! # % % #!! # ( &!

## $%& %& ## () #) (( * (+++ () #) #) (+ (+ #) #) ( #, - #)). #))- # ( / / / / $ # ( * *..# 4 #$ 3 ( 5 ) ### 4 $ # 5, $ ## # 4 $# 5 ( %

第六章 数据分析(排列组合、概率和数据描述)

<4D F736F F D20C9CFBAA3B2C6BEADB4F3D1A C4EAC9CFB5B3D1B5B0E0BDE1D2B5C0EDC2DBCCE2BFE2A3A8746F20D1A7D4B1A3A92E646F6378>

CC213

IO

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C Project 30 C Project 3 60 Project 40

目录

untitled

<443A5C B75705CC4DAC8DD5CD2BBA1A2C6C0B9C0CEC4BCFE5C312EA1B6BDCCD3FDB2BFB0ECB9ABCCFCB9D8D3DAC8ABC3E6BFAAD5B9B8DFD6B0B8DFD7A8D4BAD0A3C8CBB2C5C5E0D1F8B9A4D7F7CBAEC6BDC6C0B9C0B5C4CDA8D6AAA1B7A3A8BDCCB8DFCCFC5B D3136BAC5A3A92E646F6

因 味 V 取 性 又 鸟 U 且 最 大 罗 海 惜 梅 理 春 并 贵 K a t h l ee n S c h w e r d t n er M f l e z S e b a s t i a n C A Fe rs e T 民 伊 ' 国 漳 尤 地 视 峰 州 至 周 期 甚 主 第 应

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha

PowerPoint Presentation

美鳳吃透透

上海市教育考试院关于印发新修订的

高 职 计 算 机 类 优 秀 教 材 书 目 * 序 号 书 号 (ISBN) 书 名 作 者 定 价 出 版 / 印 刷 日 期 ** 配 套 资 源 页 码 计 算 机 基 础 课 计 算 机 应 用 基 础 刘 升 贵 年 8 月

数 学 高 分 的 展 望 一 管 理 类 联 考 分 析 第 一 篇 大 纲 解 析 篇 编 写 : 孙 华 明 1 综 合 能 力 考 试 时 间 :014 年 1 月 4 日 上 午 8:30~11:30 分 值 分 配 : 数 学 :75 分 逻 辑 :60 分 作 文 :65 分 ; 总

Ps22Pdf

e 2 3 2

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2

zt

E. (A) (B) (C) (D). () () () (A) (B) (C) (D) (E). () () () (A) (B) (C) (D) (E). (A)(B)(C) (D) (E) (A) (B) (C) (D) (E) (A) (B)(C) (D) (E). (A) (B) (C)

untitled

untitled

上海市本科教学质量年度报告

CHAPTER VC#

(京)新登字063号

Transcription:

C, Win-TC Turbo C,,

C, C,,,, C C, : Win-TC C, 23,,, 15,, C Turbo C Win-TC Turbo C,,,, 2005 1

W in -TC 1 Win-TC 1 1. Win-TC 1 2. Win-TC 1 3. Win-TC 1 2 Win-TC 3 1. 3 2. 3 3. 4 4. 4 5. 4 6. 4 7. 5 8. 5 9. 5 10. HTML 5 3 Win-TC 6 1. 6 2. 6 3. 6 4. 7 5. 7 6. 7 7. 7 8. 8 9. 8 4 12 1. 12

2. 12 3. 13 4. 13 5 Win-TC 16 1. ASCII 16 2. 17 3. DOS 18 4. / / / * * / 19 5. LIB 19 6 Win-TC 21 C 1 Win-TC 22 2 23 3 25 4 1 27 5 2 29 6 1 30 7 2 31 8 3 31 9 4 32 10 33 11 34 12 34 13 35 14 37 15 39 16 40 17 42 18 43 19 44 20 46 21 49 22 49

23 50 C 1 52 2 56 3 59 4 61 5 67 6 76 7 81 8 85 9 86 10 91 11 93 12 99 13 103 14 113 15 127 1 C 137 2 Turbo C 141 3 200 3

W in -TC 1 Win-TC 1. Win-T C ( 1 ) Win-TC, : Pentium133 CPU 32MB ( 64MB, 4GB) 2 GB, 850MB Win98 /Win2000 / Win XP ( 2 ) Windows Win-TC18, 2. Win-T C ( 1 ) Win-TC : Win-TC : ( ) Win-TC ( 2 ) Win-TC : Win-TC : : Alt + F4 : : 3. Win-TC Win-TC, 1. 1

1. 1 Win-TC ( 1 ),, noname. c ( 2 ) Win-TC 5,, Win-TC 1. 2 ( 3 ) Win-TC, ( 4 ), Win-TC, ( 5 ), ( 6 ), ( 7 ),

Win-TC 1. 2 Win-TC 2 Win-TC 1. : : Ctrl + N : 2. 3 :

: Ctrl + O : 3. ( 1 ) : : Ctrl + S : ( 2 ) : 4. ( 1 ) : : ( 2 ) BGI ( ) : BGI : BGI 5. ( 1 ) Win-TC : : ( 2 ) Windows : Windows ( ) 6. ( 1 ) Win-TC :

Win-TC : ( 2 ) Windows : Windows ( ) 7. ( 1 ) Win-TC : : ( 2 ) Windows : Windows ( ) 8. ( 1 ) Win-TC : : ( 2 ) Windows : Windows ( ) 9. ( 1 ) Win-TC :... :... ( 2 ) Windows : Windows ( ) 10. HTML 5 : HTML

3 Win-TC 1. Win-TC,, ( 1 ) : ( ), ( ),,, ( 2 ) : ( ),, Shift ( ) :, Shift,,, ( 3 ) : Ctrl + A : :,, 2.,, : : : Ctrl + C : 3.,, :

Win-TC : : Ctrl + X : 4. ( ),, Del : 5.,, : : : Ctrl + P : 6. ( ), ( ), : ( ) : trl + F( ) : ( ) 7. ( ), ( ), : ( ) ( ) 7

: ( ) ( ) 8.,,, :, 9. ( ), Win-TC : 3. 1 3. 1

Win-TC ( 1 ) : : 3232, : 1616, Win-TC, : 4, 0 9999 0: N, 0 N 4,, 0001, 1 Win-TC noname. c : Win-TC project noname. c : : Win-TC,, C : 99,, 999 :, ( pixel) ( 2 ) ( ) ( 3. 2 ), ; ( ) ; 9

3. 2 ( ) ( ) 1024768,, Win-TC ( 3 ) ( 3. 3 ), VC, VC TAB, TAB ( TAB ) Win-TC,, 4

Win-TC 3. 3 ( 4 ) ( 3. 4 ) 11 3. 4

,,. tpl, Win-TC, :,, 4 1. ( ),, ( ), ( obj ) ( exe ),,, : : F9 :, ;,,,, 4. 1 ; 4. 2 2., ( exe ), : : Windows

Win-TC 4. 1 4. 2 : : Win-TC : : Ctrl + F9 : 3., : 4., : 4. 3, 5, ( 1 ), 6 :, 64K,, CS = DS = SS = ES near.exe DOS EXE2 BIN.COM : 64K, 64K 13

4. 3, DS = SS = ES near : 64K, near 64K( 1M), far : 64K, far 64K, near, 64K, far : far, 1MB, 64K : far,,, Turbo C 64K, 64K

( 2 ) : : : : ( 3 ) Win-TC Turbo C 2 Turbo C 2. 01 Turbo C 2 : Turbo C 2, Turbo C 2. 01 : Turbo C 2. 01, ( 4 ) FOR Turbo C 2 LIB LIB, LIB,, 10 LIB, LIB Win-TC ( 5 ) : / * * /, : / * aa / * bb * / cc * / :,, ASM,. exe. obj. exe, Obj : C. obj Map : C. map :, :,, / / : 15

:,, 5 Win-TC 1. ASCII Win-TC ASCII, ASCII ASCII : Alt + ASCII ASCII : ASCII ASCII 5. 1 5. 1 ASCII

Win-TC 2. Win-TC,, EXE ( 5. 2 ),, 5. 2 1212 1616 DOS, 16 16, 6, : void drawmat( char * mat, int matsize, int x, int y, int color) / * : ( x, y) * / { nt i, j, k, n; n = ( matsize - 1) /8 + 1 ; for( j = 0; j < matsize; j + + ) for( i = 0; i < n; i + + ) for( k = 0; k < 8; k + + ) if( mat[ j* n + i] &( 0x80 > > k) ) / * 1 * / 17

putpixel( x + i* 8 + k, y + j, color) ; 3. DOS : CCDOS, PDOS95, Windows 98 PDOS95 DOS Windows 2000 Windows XP, PDOS95 DOS, UCDOS, Win-TC DOS, DOS DOS, DOS DOS,, EXE ( 5. 3 ) DOS,,, DOS,, DOS, 32 PE 16 NE,, DOS EXE 5. 3 DOS

Win-TC 4. / //* * / Win-TC C + +, / / Win- TC / / / /, #include / /, #include/ /,, / /, /* * / TC2 TC2, / // * * // / / * * /, TC2 5. LIB ( 1 ) Turbo C,, Win-TC, ( LIB) LIB FOR Turbo C FOR Visual C FOR Turbo C, (, *. h ) Win-TC include, *. lib lib, Win-TC, LIB,, ( 2 ) LIB LIB LIB? : ( OBJ) mylib / * * * * * mylib. c * * * * * / void myfun( ) { printf( \ nmyfun( ) in mylib. lib \ n ) ; Win-TC mylib. c OBJ,, 19

, ( F9 ) : LIB ( LIB) Win-TC mylib. obj Win-TC BIN, makelib. bat, : Tlib mylib. lib + mylib. obj, BIN mylib. lib : ( *. h) LIB BIN mylib. lib Win-TC lib mylib. lib,, : Win-TC, :void myfun( ) ;, #ifndef... #define... #endif, MYLIB, : #ifndef #define MYLIB MYLIB void myfun( ) ; #endif,, ( *. h), Win-TC INCLUDE,, mylib, INCLUDE mylib. h : LIB : #include mylib. h / * * / { yfun( ) ; getch( ) ; Ctrl + F9, : myfun( ) in mylib. lib, LIB

Win-TC 6 Win-TC ; ( ; ) ;, ; 1 Win 2000 Win XP Win-TC Win 2000 Win XP,,, getch( ), { printf( This is a TurboC. ) ; : { printf( This is a TurboC. ) ; getch( ) ;, :, 21

C 1 Win -TC 1. C 2. Win-TC 3. C 1. Win-TC, Win-TC 2. Win-TC 3. Win-TC, Win-TC 4. Win-TC 5. Win-TC 6. Win-TC 7. : #include stdio. h { printf( This is C program! ) ; ( 1 ) ( 2 ), ( 3 ), : I am a student! ( 4 ), : I am a student!

C 2 1. C 2. C 3. C 1. ( 1 ) printf( % d, 2 /3) ; ( 2 ) printf( % f, 2. 0 /3) ; ( 3 ) printf( % d, 2 /3* 100) ; ( 4 ) printf( % f, 2. 0 /3* 100) ; ( 5 ) printf( % d, 2 / ( 3* 100) ) ; ( 6 ) printf( % f, 2. / ( 3* 100) ) ; ( 7 ) printf( % d, 2. / ( 3* 100) ) ; ( 8 ) printf( % d, 2% 3) ; ( 9 ) printf( % d, 3% 2) ; ( 10) printf( % d, 3. 0% 2 ) ; 2. ( 1 ) = 3; j = 3 ; j = ( i + + ) + ( i + + ) + ( i + + ) ; printf( i = % d, j = % d, i, j) ; ( 2 ) = 3; j = 3 ; j = ( + + i) + ( + + i) + ( + + i) ; printf( i = % d, j = % d, i, j) ; ( 3 ) = 3; printf( a = % d \n, a) ; printf( a = % d \ n, a + + ) ; printf( a = % d \ n, + + a) ; 23

( 4 ) printf( % d, 1234567. 89) ; ( 5 ) printf( % ld, 1234567. 89) ; ( 6 ) printf( % f, 1234567. 89) ; ( 7 ) printf( % 12. 4f, 1234567. 89) ; 3. ( 1 ) printf( % d, + + 4) ; ( 2 ) i = 3; j = 4 ; printf( % d, + + ( i + j) ) ; ( 3 ) i = 3; printf( % d, + + i + + ) ; ( 4 ) i = 3; printf( % d, + + + + i) ; ( 5 ) printf( % d, 5. 0% 3) ; ( 6 ) printf( % d, 5. 0% 3. 0) ; 4. ( 1 ) x = 4; x = 4 * 6, x* 5; x? ( 2 ) x = 4; x = ( 4* 6, x* 5 ) ; x? ( 3 ) a = 12; a + = a - = a* = a; a? ( 4 ) z = 7; z = 3 * z - - ; z? 5. ( 1 ) { nt i, j, m, n; i = 8; j = 10; m = i + + ; n = + + j; printf( % d, % d, % d, % d, i, j, m, n) ; 5 6 m = + + i; n = j + + ;? ( 2 ) define AMT a + a + a #define ATT AMT - AMT { nt a = 2; printf( % d, ATT) ;

C 3 1. C 2. printf( ) 3. scanf( ) 4. putchar( ) getchar( ) 1. : #include stdio. h { har m = 97, n; n = getchar( ) ; putchar( m) ; putchar( n) ; ( 1 ) ( 2 ) 1,? 2. : { nt a = - 1; printf( % d, a) ; printf( % u, a) ; ( 1 ) ( 2 ) a = - 2,?? 3. : { nt a = 20; 25

printf( % d, a) ; printf( % o, a) ; printf( % x, a) ; ( 1 ) ( 2 ) a = - 2,?? 4. : { nt a = 20; float b = 12. 3456 ; printf( % - 5d#, % d* % 06. 2f, a, a, b) ; 5. : { nt a; float b; scanf( %, % d, a, b) ; printf( % d* % d, a, b) ; ( 1 ), ( 2 ) 4 : scanf( % o, % f, a, b) ;, 6. : { nt a, b; scanf( % 2d% * 3d% 2 d, &a, &b) ; printf( % d* % d, a, b) ; ( 1 ), 1234567, ( 2 ) 3 : scanf( % 3d% 3d, &a, &b) ;,?

C 1.,? 2. printf( ) scanf( ) 4 1 1. if if... else... 2. 3. 1. ( 1 ) nt a; a = 5 > 3; printf( % d, a) ; ( 2 ) printf( % d,! 9) ; ( 3 ) nt a = 1, b = 2, c = 3, d = 4, m, n = 1; ( m = a > b) &&( n = c > d) ; printf( m = % d, n = % d, m, n) ; 2., { nt x = 1, y = 1, z = 1; y = y + z; x = x + y; printf( % d \ n, x < y? y: x) ; printf( % d \ n, x < y? x + + : y + + ) ; printf( % d \ n, x) ; printf( % d \ n, y) ; 27

x = 3; y = z = 4; printf( % d \ n, x > = y > = x? 1: 0) ; printf( % d \ n, z > = y&&y > = x) ; 3., ( 1 ) ain( ) { nt x; if x = 2) el e ( 2 ) ain( ) printf( all right! ) ; printf( it is wrong! ) ; { nt x; scanf( % d, &x) ; if( 2) else ( 3 ) ain( ) printf( all right! ) ; printf( it is wrong! ) ; { nt x = 3, y = 4, z = 5, ; if x < z) el e printf( % d, x + + ) ; if( y < z) else printf( % d, + + y) ; printf( % d, + + z) ; 4. ax 2 + bx + c = 0 : 1) a = 0,, x = - c / b ( 2) a = b = 0,

C ( 3) a0 : b 2-4ac > 0, ; b 2-4ac = 0, ; b 2-4ac < 0, 5. 3 a, b, c, : 1) a, b, c 0, ; ( 2), ; ( 3), ; ( 4) area = s( s - a) ( s - b) ( s - c), s = ( a + b + c) /2 6. : x 2-1, x < 0, y = 0, x = 0, x 2 + 1, x > 0, y, x 5 2 switch 1., { int x = 1, y = 0 ; switch( x) { case 1 : switch( y) { case 0 : rintf( * * 1* * \ n ) ; break; 29

, : case 1: printf( * * 2* * \n ) ; break; case 2: printf( * * 3 * * \ n ) ; 2.,, s s > 100, 95 ; s > 300, 90 ; s > 500, 80 ; s > 1 000, 75 ; s > 3 000, 70 switch( ) if... else..., 6 1 while( ) 1., { int a = 1, b = 2, c = 2, t; while( a < b < c) { t = a; a = b; b = t; c - - ; printf( % d, % d, % d, a, b, c) ; 2. m n, 3. s = 1! + 2! + 3! + + 20!

C 7 2 do... while( ) ) 1., { nt x = 0, y = 0 ; do { y + + ; x + = + + y; while( x < 18 ) ; printf( % d, % d, x, y) ; 2. 5 100 5 7 ( 3. s = 2 + 4 + 8 + + n ( n = 3 200 ) 8 3 for 1., { nt x = 1, y = 2, z = 3; for( ; < = 105; x + +, y + + ) 31

z = x* y* z; printf( % d, % d \n, x, y) ; 2. e, 10-6 e = 1 + 1 /1! + 1 /2! + + 1 / n! 3.,,, 128,,,,,,,,,,, 64,,,,,,, 1,,,,, C, 9 4 continue break 1. break, s = 2 + 4 + 6 + + 100 2. continue, 1 100 3. 5, :,,,? 1. 2.?

C 3.,? 4.,? 10 1. 2. 3. 1., #include stdio. h { nt i, c[ 5 ] ; int a[ ] = {9, 7, 5, 3, 1 ; int b[ ] = { - 2, - 4, - 6, - 8, - 10 ; f r( i = 0 ; i < 5; i + + ) c[ i] = a[ i] + b[ i] ; for( i = 0; i < 5 ; i + + ) printf( % 8d, c[ i] ) ; 2. 40, 3. 10 ( ) 4. 10 5. 33

11 1. 2. 1., #include stdio. h { nt a[ 3] [ 3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, i, x = 0 ; for( i = 0; i < = 2 ; i + + ) x + = a[ i] [ i] ; printf( % d \ n, x) ; 2. 55 3., (, ) 4. ( 9 ) : 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 12 1.

C 2. 1., #include stdio. h { har a[ ] = { a, b, c, d, \0, x, y, z, \0 ; printf( % s, a) ; 2. #include stdio. h { har a[ 5 ], b[ 5] ; int i; for( i = 0; i < 5 ; i + + ) scanf( % c, a[ i] ) ; scanf( % s, b[ i] ) ; printf( % s\ n% s \n, a, b) ; 3. ( * ) * * * * * * * * * * * * * * * * * * * * * * * * * 13 1. 2. 3. 35

1., #include stdio. h int fun1( ) { int x = 5; printf( % d \ t, x) ; return x; int fun2( int x) { printf( % d \ t, + + x) ; return x; { int x = 2; x = fun1( ) ; x = fun2( x) ; printf( % d \ n, x) ; 2.,, #include stdio. h { nt x = 4, y = 2 ; printf( % d \ n, mm( x* y) ) ; int mm( u, v) { int u, v; return( u* v) ; 3., f( x) = x 2 + 1, x > 1, x 2, - 1x1, x 2-1, x < - 1 double fun( double x)

C 4. ax 2 + bx + c = 0, b 2-4ac 0 0 0 a, b, c 5. n! ( n = 10) n! = 1, n = 1, ( n - 1)!n, n > 1 6. n, : 1, n = 0, P n ( x) = x, n = 1, [ ( 2 n - 1) x - P n - 1 ( x) - ( n - 1) P n - 2 ( x) ] /n, n > 1 14 1. 2. 1., ( 1 ) include stdio. h void fun1( ) { nt x = 5; printf( % d \ t, x) ; void fun2( int x) { printf( % d \ t, + + x) ; { nt x = 2; fun1( ) ; fun2( x) ; 37

printf( % d \ n, x) ; ( 2 ) include stdio. h int x, y; { = 5 ; f( x) ; f( x) ; getch( ) ; int f( int x) { = x + + ; printf( % d \ n, y) ; ( 3 ) include stdio. h int x, y; { = 5 ; f( ) ; f( ) ; getch( ) ; int f( ) { = x + + ; printf( % d \ n, y) ; ( 4 ) include stdio. h int x, y; { = 5 ; f( x) ; f( x) ; getch( ) ; int f( ) { = x + + ; printf( % d \ n, y) ;

C ( 5 ) include stdio. h int x, y; { = 5 ; f( x) ; f( x) ; getch( ) ; int f( x) { = x + + ; printf( % d \ n, y) ; 15 1. 2. 3. 1., #define MAX( a, b) ( ( a) > ( b)?( a) : ( b) ) 2., ( a) > ( b),?? 3., 4., f1. c, #define MAX( a, b) ( ( a) > ( b)?( a) : ( b) ) #include stdio. h 1, #include f1. c, 39

, 5., #define LETTER 1 { har str[ 20] = C language, c; int i; i = 0; while( ( c = str[ i] )! = \0 ) { i + + ; #if LETTER #else #endif printf( % c, c) ; if( c > = a &&c < = z ) c = c - 32; if( c > = A &&c < = Z ) c = c + 32; 16 1. 2. 1. #include stdio. h { nt a; int * p; p = &a; scanf( % d, &a) ;

printf( % d \ n, a) ; C :, 2., #include stdio. h / * 3, * / { nt a, b, c; int * p1, * p2, * p3; scanf( % d, % d, % d, &a, &b, &c) ; p1 = &a; p2 = &b; p3 = &c; if( a > b) swap( p1, p2) ; if( a > c) swap( p1, p3) ; if( b > c) swap( p2, p3) ; printf( % d, % d, % d, a, b, c) ; swap( int * p1, int * p2) { nt x; ( 1 ), ( 2 ) : swap *,?? 3., #include stdio. h sub( int x, int y, int * z) { * z = y - x; { nt a, b, c; sub( 10, 5, &a) ; sub( 7, a, &b) ; sub( a, b, &c) ; printf( % 4d, % 4 d, % 4d \ n, a, b, c) ; 41

17 1. 2. 3. 1. : int a[ 10] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, i = 0; int * p; ( 1 ) p? ( 2 ) 2. p,? ( 1 ) * p; ( 2 ) * ( p + + ) ; ( 3 ) * p + + ; ( 4 ) * ( p + + ) * ( + + p), * ( p + + ) a [ i + + ]? 3. : 10,, { nt number[ 10 ] ; int * p, i; printf( input 10 numbers: ) ; fo ( i = 0 ; i < 10; i + + ) scanf( % d, &number[ i] ) ; maxminvalue( number) ; printf( New order: ) ;

C for( p = number; p < = number + 9; p + + ) printf( % d, * p) ; maxminvalue( int array[ 10] ) { nt * max, * min, * p, * end; end = array + 9; max = min = array; for( p = array + 1; p < = end; p + + ) if( * max < * p) max = p; * p = array[ 9] ; array[ 9] = * max; * max = * p; f r p = array + 1; p < = end; p + + ) if * min > * p) min = p; return; 18 1. 2. 1., 33, { nt a[ 3] [ 3], * p, i; printf( input matrix: \ n ) ; for( i = 0; i < 3 ; i + + ) scanf( % d% d% d, &a[ i] [ 1], &a[ i] [ 2 ], &a[ i] [ 3] ) ; p = &a[ 0] [ 0] ; 43

for( i = 0; i < 3 ; i + + ) for( j = 0; j < 3 ; j + + ) = * ( p + 3* i + j) ; * ( p + 3 * i + j) = * ( p + 3* j + i) ; * ( p + 3 * j + i) = t; printf( New matrix: \n ) ; for( i = 0; i < 3 ; i + + ) printf( % d% d% d \ n, a[ i] [ 0], a[ i] [ 1], a[ i] [ 2] ) ; 2., 19 1. 2. 1. #include stdio. h #include string. h chnum( char * p) { nt num = 0 ; fo ( ; * p! = \0 ; p + + ) num = num* 10 + * p- 0 ; return( num) ; { har s[ 8 ] ;

C int n; gets( s) ; if( * s = = - ) n = - chnum( s + 1) ; else n = chnum( s) ; printf( % d \ n, n) ; ( 1 ) - 2345 < >,? ( 2 ) 2345 < >,? 2. strcmp( ), #include stdio. h { nt n; char s1[ 10], s2[ 10 ] ; char * p, * q; printf( input 2 strings: \ n ) ; gets( s1) ; gets( s2) ; p = s1; q = s2; n = strcmp( p, q) ; printf( result: % d \n, n) ; nt strcmp( char * p, char * q) { nt i = 0, m; while( * ( p + i) = = * ( q + i) ) { f( break; i + + ; m = * ( p + i) - * ( q + i) ; return( m) ; ( 1 ) rechard < > rechard < >,? ( 2 ) rechard < > heland < >,? 45

( 3 ) heland < > rechard < >,? ( 4 ), 20 1. 2. 1. :, #include stdio. h stru t yymmdd { nt day; int month; int year; data; { nt days( int, int, int) ; int i, daysum; printf( please input year - month - day: ) ; scanf( % d, % d, % d, &data. year, &data. month, &data. day) ; daysum = days( data. year, data. month, data. day) ; printf( \ nthe dayth is % d \n, daysum) ; days( int year, int month, int day) / * * / { nt daysum, i; int tt[ 13 ] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ;

C daysum = 0; for( i = 1; i < month; i + + ) daysum = daysum + tt[ i] ; if( onth >= 3&&( year% 4 = = 0&&year% 100! = 0 year% 4 == 0) ) daysum + = 1; return( daysum) ; 2. : a b,, a b,, #include stdio. h struct ; tudent{ char num[ 10 ] ; float cj; struct student * next; { truct student a[ 4] = { { 001, 90, { 002, 85, 003, 91, { 004, 76 ; struct student b[ 5] = { { 005, 85, 006, 68, { 003, 91, int i, j; { 008, 64, { 007, 78 ; struct student * p, * p1, * p2, * pt, * head1, * head2 ; head1 = a; /* * / head2 = b; printf( list a: \ n ) ; for p1 = head1, i = 1; p1 < a + 4; i + + ) { = p1; p1 - > next = a + i; printf( % 8 s% 8. 1 f\ n, p1 - > num, p1 - > cj) ; p1 = p1 - > next; 47

p - > next = 0; printf( list b: \ n ) ; for p2 = head2, i = 1; p2 < b + 5; i + + ) { = p2; p2 - > next = b + i; printf( % 8 s% 8. 1 f\ n, p2 - > num, p2 - > cj) ; p2 = p2 - > next; printf( \ n ) ; p1 = head1; /* * / while( p1! = 0) { 2 = head2; while( p2! = 0&&strcmp( p1 - > num, p2 - > num)! = 0) p2 = p2 - > next; if strcmp( p1 - > num, p2 - > num) = = 0) if( p1 = = head1) head1 = p1 - > next; else p - > next = p1 - > next; p = p1 ; p1 = p1 - > next; p1 = head1; /* * / printf( \ n result: \ n ) ; while( { printf( % 8s% 8. 1f\ n, p1 - > num, p1 - > cj) ; 1 = p1 - > next;

C 21 1. 2. union study { nt i[ 2] ; x; float a; long b; char c; { canf( % d, % d, &x. i[ 0 ], &x. i[ 1 ] ) ; printf( i[ 0] = % d, i[ 1] = % d, a = % f, b = % ld, c = % c \ n, x. i[ 0], x. i[ 1], x. a, x. b, x. c) ; 1000, 2000, : scanf( % ld, &x. b) ; printf, 60000,?? 22 1. 2. 49

( : 16, 0) { nsigned int a, b; int n1, n2; printf( input a octal number: ) ; scanf( % o, &a) ; printf( input n1, n2 ) ; scanf( % d, % d, &n1, &n2) ; b = 0; b = ( b > > n1) &( b < < ( 16 - n2 ) ) ; b = a&b; b = b > > ( 16 - n2) ; printf( result: % o \n, b) ; 177776 < > 5, 10 < >, 000011 < > 5, 10 < >, 23 1. 2. 1. : #include stdio. h

{ ILE * p; char ch, filename[ 10] ; scanf( % s, filename) ; if ( p = fopen( filename, w ) ) = = NULL) { rintf( cannot open file \n ) ; exit( - 1 ) ; while( ( ch = getchar( ) )! = \ n ) fputc( ch, p) ; fclose( p) ; ( 1 ) head1. c < > ) welcome to c < > C ( ), ( 2 ) wr, while : while( ( ch = fgetc( p) )! = EOF) putchar( ch) ; head1. c < >, 2., 51

C 1 1. C ( ) ( ) ( ) 2. C ( ) ( ) ( ) 3. C ( ) 4. C ( ) 5. C ( ) 6. int a; a ( ) float x; x ( ) char u; u ( ) 7. C int ( ), float ( ), char ( ) 8. int x = 6;, x% 2 + ( x + 1) % 2 ( ) 9. int x;, x = 25 /3% 3 ( ) 10. int a = 6;, a + = a - = a* a ( ) 11. int a;, ( a = 4* 5, a* 2), a + 6 ( ) 12. int x, a;, ( 1) x ( ), ( 2 ) x ( ) ( 1 ) x = ( a = 4, 6* 2) ( 2) x = a = 4, 6* 2 13. char ch;, ch = a + 8-3 ( 14. C ( ) 15. C ( ) 16. C ( ) 17. C, LEI lei ( ) ) 18. int float char ( ) ( )

( ) ( ) ( C 19. int x;, scanf( % f, x) ; x, ( ) ( ) 20. int a, b scanf( ) ( ) 21. int a, b, 5, printf( ) ) 22. float x, y, 6, 2, printf( ) ( ) 1. C ( ) A) ) C) D) 2. ( ) A) A P 0 do B) float 1a0 A C) b - a goto int 3. ( ) A) 160-0xffff 011 B) - 0xcdf 01a 0xe C) - 01 968 0668 4. ( ) D) 123 temp INT D) - 0x48a 2e5 A) + 1e + 1 B) -. 60 C) 123e D) - e3 5e - 9. 4 12e - 4 1. 2e -. 4. 8e - 4 03 e2-8e5 + 2e - 1 5. e - 0 5. ( ) A) \ \ \ \ n B) \ \017 \ 6. ( ) C) \018 \ f \ xab 0x D) \ \0 A) lei B) y + x C) minx. D) aax* 7. ( ) \101 \ x1f A) aaa B) ax1 C) 9 xx D) max 2 8. ( ) A) short a = 1 -. le - 1; B) double b = 1 + 5e2. 5; 53

C) long do = 0xfdaL; D) float 2 and = 1 - e - 3; 9. C, ( ) A) B), C) D) 10. ( ) A) x B) W C) D) XYZ 11. ( ) A) x B) ABC C) ABC D) 1 12. C, ( ) A) + + B) / C) % D) * 13. int a = 5, y; y = a + + ;, a, y ( ) A) a = 6, y = 5 B) a = 6, y = 6 C) a = 6, y = 7 D) a = 5, y = 6 14. C ( ) A) ( ) B) [ ] C) { D) 15. int k, a, b; unsigned long w = 5; double x = 1. 42;, C ( ) A) x% ( - 3 ) B) w + = - 2 C) k = ( a = 2, b = 3, a + b) D) a + = a - = ( b = 4) * ( a = 3) 16. int a = 7; float x = 2. 5, y = 4. 7 ;, x + a% 3 * ( int) ( x + y) % 2 /4 ( ) A) 2. 500000 B) 2. 750000 C) 3. 500000 D) 0. 000000 17. : char w; int x; float y; double z;, w* x + z - y ( ) A) float B) char C) int D) double 18. int, 7 ( ) A) ( x = y = 6, x + y, x + 1 ) B) ( x = y = 6, x + y, y + 1 ) C) ( x = 6, x + 1, y = 6, x + y) D) ( y = 6, y + 1, x = y, x + 1) 19. 3ae, C ( ) bc A) a / b / c* e* 3 B) 3 * a* e / b /c C) 3* a* e /b* c D) a* e /c / b* 3 20. scanf( ) ( ) A) % f B) % u C) % o D) % c 21. int a, b = 5;, a ( )

A) 10 + 2 = a; B) scanf( % d, &a) ; C) a = ( b + 6 ) /3; D) a = c ; 22. int a; &a ( ) A) B) a C) a D) 1. int a; a = 90000; 2. char c; c = y ; 3. int a, b; scanf( % D, % D, &a, &b) ; 4. int a = 10 ; float x = 1. 25; printf( % f, % d, a, x) ; 5. int i = j = k = 0; 1. ain( ) { nt x = 1, y = 1; 2. ain( ) x = x + y; y = x + y; printf ( x = % d y = % d \ n, x, y) ; { nt x = 7, a = 2, b = 2, c; c = x /a% b; printf( c = % d \n, c) ; 1., C 55

2., C = 5 9 ( F - 32) * / 3. a b, av, s1 s2 #include math. h / * sqrt( ), math. h 4., v 0 q g = 9. 8 s( s = 2v 2 0 sinqcosq / g) 2 1. A ASCII 65, ( ) { har ch1, ch2 ; ch1 = A + 5-3 ; ch2 = A + 6-3 ; printf( % d, % c \ n, ch1, ch2) ; A) 67, D B) 3, C C) C, D D)

C 2. ( ) { nt x = f ; printf( % c \n, A + ( x - a + 1) ) ; A) G B) H C) I D) J 3. ( ) # include < stdio. h > { nt a, b, d = 241; a = d /100% 9; b = ( - 1) * ( - 1) ; printf( % d, % d \ n, a, b) ; A) 6, 1 B) 2, 1 C) 6, 0 D) 2, 0 4. ( ) { ouble d = 3. 2 ; int x, y; x = 1. 2; y = ( x + 3. 8) /5. 0; printf( % d \n, d* y) ; A) 3 B) 3. 2 C) 0 D) 3. 07 5. sizeof( double) ( ) A) B) C) D) 6. printf( a \bre \ hi \ y \ \ \ bou \ n ) ; ( ) A) a \ bre \ hi \ y \ \ \bou C) re hi you B) a \ bre \ hi \ y\ bou D) abre hi y \ bou 7., ( ) A) + + t; B) n1 = ( n2 = ( n3 = 0) ) ; C) k = i = = j; D) b + c = 1; 8. : int i = 65536; printf( % d \n, i) ; 57

( ) ( ) A) 65536 B) 0 C), D) - 1 9. ( ) { nt x = 10, y = 3; printf( % d \n, y = x/ y) ; A) 0 B) 1 C) 3 D) 10. ( ) { nt a = 12, b = 12; printf( % d, % d \ n, a - -, b + + ) ; A) 11, 12 B) 12, 11 C) 12, 12 D) 11, 11 11. ( ) { nt a = 12, b = 12; printf( % d % d \n, - - a, + + b) ; A) 10 10 B) 12 12 C) 11 10 D) 11 13 12. int x = 11;, ( x + +* 1 /3) ( ) A) 3 B) 4 C) 11 D) 12 13. x int, x = 10 ; x + = x - = x - x;, x A) 10 B) 20 C) 40 D) 30 14. x, y, z k int, x = ( y = 4, z = 16, k = 32), x ( ) A) 4 B) 16 C) 32 D) 52 15. x y int, x = 100, y = 200, : printf( % d, ( x, y) ) ; ( ) A) 200 B) 100 C) 100 200 D),

C 16. x y int, x + = y; y = x - y; x - = y; ( ) A) x y B) x y C) D) x y 3 1. ( ) { ouble d; float f; long l; int i; i = f = l = d = 20 /3; printf( % d % ld %. 1f %. 1 f\n, i, l, f, d) ; A) 6 6 6. 0 6. 0 B) 6 6 6. 7 6. 7 C) 6 6 6. 0 6. 7 D) 6 6 6. 7 6. 0 2. : 123 < > 456 < > 789 < >, ( ) { har s[ 100] ; int c, i; scanf( % c, &c) ; scanf( % d, &i) ; scanf( % s, s) ; printf( % c, % d, % s \ n, c, i, s) ; A) 123, 456, 789 B) 1, 456, 789 C) 1, 23, 456, 789 D) 1, 23, 456 3. ( ) { nt k = 17; printf( % d, % o, % x \n, k, k, k) ; A) 17, 021, 0 x11 B) 17, 17, 17 C) 17, 0x11, 021 D) 17, 21, 11 59

4. ( ) { int k = 11; printf( k = % d, k = % o, k = % x \ n, k, k, k) ; A) k = 11, k = 12, k = 11 B) k = 11, k = 13, k = 13 C) k = 11, k = 013, k = 0xb D) k = 11, k = 13, k = b 5., a1, a2, c1, c2 10, 20, A, B,, ( int a1, a2; char c1, c2 ; scanf( % d% d, &a1, &a2) ; scanf( % c% c, &c1, &c2) ; A) 1020AB < > B) 0 20 < > AB < > ) ( ) C) 10 20 AB < > D) 10 20 AB < > 6., ( ) : float f1, f2; :. 52 3. 5 A) scanf( % f, % f, &f1, &f2) ; B) scanf( % f% f, &f1, &f2 ) ; C) scanf( % 3. 2f % 2. 1 f, &f1, &f2) ; D) scanf( % 3. 2f% 2. 1f, &f1, &f2) ; 7., : 25, 13, 10 < >, ( ) { nt x, y, z; scanf( % d% d% d, &x, &y, &z) ; printf( x + y + z = % d \ n, x + y + z) ; A) x + y + z = 48 B) x + y + z = 35 C) x + z = 35 D) 8., ( )

C { nt x; float y; printf( enter x, y: ) ; enter x, y: 2 3. 4 x + y = 5. 40 A) canf( % d, % f, &x, &y) ; printf( \ nx + y = % 4. 2f, x + y) ; B) canf( % d% f, &x, &y) ; printf( \ nx + y = % 4. 2f, x + y) ; C) canf( % d% f, &x, &y) ; printf( \ nx + y = % 6. 1f, x + y) ; D) canf( % d% 3. 1 f, &x, &y) ; printf( \ nx + y = % 4. 2f, x + y) ; 4 ( 1. C, ( ), ( ) 2. C ( ), ( ) 3. ( ) 4. ( ) 5. ( ) 6. ) 7. a, b, : ( 1 ) a&&b ( ) ( 2 )! ( a b) &&a ( ) ( 3 )! a b ( ) ( 4 ) ( a&&! b) ( b&&! a) ( ) 8. int a, b, c;, a b c ( ) 9. int a, b, c;, a, b, c 0 ( ) 10. 0 < = x < = 100 x < - 100 ( ) 61

11. a, b, c, ( ), ( ) 12. int x = 5, y = 6, z = 1;, : ( 1 ) x + y && z ( ) ( 2 ) x + y > 8 && x - y > 1 ( ) ( 3 ) x + y > 8 x - y > 1 ( ) ( 4 ) z = = y > 0 ( ) ( 5 )! x < z ( ) 13. 5 > 3 && 2 8 < 4 -! 1 ( ) 14. int a = 1, b = 2;, ( a < b? a: b) ( ) 15. switch break ( ) 1. C, > = ( ) A) B) C) D) 2., ( ) A)! B) && C) + D) 3., ( ) A)! B) && C) + D) 4. int a = 2, b = 5;, a + 5 > b + 3 ( ) A) 0 B) 1 C) D) 5. : int a = 1, b = 2, c = 3, d = 4, m = 2, n = 2; : ( m = a > b) &&( n = c > d), n ( ) A) 1 B) 2 C) 3 D) 0 6. x, y, z, t int, x = y = z = 1; t = + + x + + y&& + + z;, t ( ) A) B) 2 C) 1 D) 0 7. a 0 ( ) A) a < > 0 B)! a C) a = 0 D) a! = 0 8. a10 a0 ( ) A) a > = 10 or a < = 0 B) a > = 10a < = 0 C) a > = 10a < = 0 D) a > = 10 &&a < = 0 9. int x = 1, y = 1;, (! x y - - ) ( )

C A) 0 B) 1 C) 2 D) - 1 10. a b ( ) A) ( a > = 0 b > = 0 ) &&( a < 0b < 0) B) ( a > = 0&&b > = 0) &&( a < 0&&b < 0) C) ( a + b > 0 ) &&( a + b < = 0) D) a* b > 0 11. ( ) { nt x = 100, a = 10, b = 20, ok1 = 5, ok2 = 0 ; if( a < b) if b! = 15) if(! ok1) x = 1; el e if( ok2 ) x = 10; else x = - 1; printf( % d \ n, x) ; A) - 1 B) 0 C) 1 D) 12. a = 1, b = 3, c = 5, d = 4,, x ( ) if( a < b) if( c < d) x = 1; else f a < c) else x = 7; if( b < d) x = 2; else x = 3; else x = 6; A) 1 B) 2 C) 3 D) 6 13. y = ( x > 0? 1: x < 0? - 1: 0 ) ; if ( ) A) f ( x > 0) y = 1; else f( x < 0) y = - 1; B) ( x) else y = 0; if( x > 0) y = 1; else f( x < 0) y = - 1; 63

C) = - 1 if x) D) = 0 ; else y = 0 ; if( x > 0 ) y = 1; else if( x = = 0 ) y = 0; else y = - 1; i ( x > = 0) i ( x > 0) y = 1; else y = - 1 ; 14. a = 1, b = 2, c = 3, d =4, a < b? a: c < d? a: d ( ) A) 4 B) 3 C) 2 D) 1 15. char ch = A, ( ) ch = ( ch > = A &&ch < = Z )? ( ch + 32) : ch A) A B) a C) Z D) z 16. ( ) { nt x = 12, y; y = x > 12? x + 10: x - 12; printf( y = % d \ n, y) ; A) y = 0 B) y = 22 C) y = 12 D) y = 10 17. switch, case ( ) A) B) C) D) 18. k 3, ( ) switch( k) { ase 1: putchar( A ) ; case 2: putchar( B ) ; case 3: putchar( C ) ; case 4: putchar( D ) ; default: putchar( E ) ; A) CDE B) C C) ABC D) ABCD

C 1. : a > b, c = 0; c = 1 int a = 1, b = 2, c; if( a > b) ; c = 0; else c = 1 ; 2. : a > b, a, b int a, b, c; scanf( % d, % d, &a, &b) ; if( a > b) c = a; a = b; b = c; 1. ain( ) { nt a = 1, b = 2, c = 3 ; if( a > c) 2. ain( ) b = a; a = c; c = b; printf( a = % d b = % d c = % d \ n, a, b, c) ; { nt a = 3, b = 2, c = 1 ; 3. ain( ) if( a > b) a = b; if( b > c) b = c; else c = b; c = a; printf( a = % d b = % d c = % d \ n, a, b, c) ; { nt x = 2, y = 3, z; z = x; if( x > y) z = 1 ; else if( x = = y) z = 0 ; else z = - 1; printf( z = % d \n, z) ; 65

4. ain( ) { nt a = 10, b = 5, x; x = a < b? b: a; printf( x = % d \n, x) ; 1. 2. 85, 10 5%, 100 10%, 2., 3., 80 100 very good!, 60 79 good!, 40 59 fair, 0 39 poor

C 4. switch,, 90 A, 80 89 B, 70 79 C, 60 69 D, 60 E 5 ( 1. while( ), ( ), ) 2. while, while ( ) 3. for( 1; 2; 3 ), ( ) 0 4. continue ( ) 5. break ( ) 6., 0 { nt a, max = 0; scanf( % d, &a) ; wh le( { f( max < a) max = a; scanf( % d, &a) ; printf( % d, max) ; 7., 67

#include stdio. h { har c; int n = 0 ; c = getchar( ) ; while( { f( n + + ; c = getchar( ) ; 8. or( a = 0, b = 0; b! = 100&&a < 5; a + + ) scanf( % d, &b) ; scanf ( ), ( ) 9. 30, 90, for x = 1 ; x < = 29; x + + ) { y = 30 - x; if( printf( % d, % d, x, y) ; 10. 1-3 + 5-7 + - 99 + 101 { nt i, t = 1, s = 0; fo ( i = 1; i < = 101; i + = 2) { s = s + t* i; printf( % d, s) ; 11. 10, 7, { nt i, a; for i = 1; i < = 10 ; i + + ) { s anf( % d, &a) ; if( a% 7 = = 0) { printf( % d, a) ;

C 1. ( ) A) B) C) D) 2. : int i; for( i = 0; i < = 10 ; i + + ) ;, i = 0, ( ) A) for B) C) for D) 3. ( ) A) do... while B) do... while break C) do... while, while D) do... while, while 4., ( ) { nt n = 0 ; while( n < = 2) { + + ; printf( % 3d, n) ; A) 1 B) 1 2 C) 1 2 3 D) 1 2 3 4 5. ( ) int a, y; a = 10; y = 0 ; do { + = 2; y + = a; printf( a = % d y = % d \ n, a, y) ; if( y > 20) break; while( a = 14) ; A) a = 12 y = 12 a = 14 y = 16 a = 16 y = 20 a = 18 y = 24 B) a = 12 y = 12 a = 16 y = 28 C) a = 12 y = 12 D) a = 12 y = 12 a = 14 y = 26 a = 14 y = 44 69

6. ( ) for( i = 1; i < = 3; i + + ) ; printf( ok ) ; A) ok B) okok C) okokok D) 7. ( ) int s = 7; while( - - s) ; s = s - 2; printf( s = % d \n, s) ; A) s = 1 B) s = 2 C) s = 0 D) s = - 2 8. ( ) a = - 1; do { a = a* a; while(! a) ; A) 1 B) 2 C) D) 9., 1, - 3, 5, 8, - 2, ( ) { nt i, x; for( i = 1; i < = 5 ; i + + ) { canf( % d, &x) ; if( x < = 0 ) continue; printf( % d, x) ; A) - 3-2 0 B) 1 5 8 C) 1-3 5 8-2 D) - 3-2 10. s = 12345 ( ) A) for( i = 1; i < = 5; i + + ) { s = 1 ; C) s = 1; s = s* i; for( i = 1; i < = 5; i + + ) s = s* i; 11. ( ) B) for( i = 1; i < = 5; i + + ) { s = 0; D) s = 0; s = s* i; for( i = 1; i < = 5; i + + ) s = s* i;

C ( ) for( i = 1; i < = 100; i + + ) { canf( % d, &x) ; if( x < 0) continue; printf( % d, x) ; A) x < 0 B) x0 C) printf( ) D) 100 12. ( ) { nt k = 10; while( k = 0) { = k - 1; printf( k = % d, k) ; A) 10 B) while C) D) 1 13. ( ) { nt k = 2; wh le( k! = 0) { rintf( k = % d, k) ; k - - ; A) B) 0 C) 2 D) 1 14., 65 14 < >, main ( ) { nt m, n; printf( Enter m, n: ) ; scanf( % d% d, &m, &n) ; while( m! = n) { hile( m > n) m - = n; while( n > m) n - = m; printf( m = % d \ n, m) ; 71

A) m = 3 B) m = 2 C) m = 1 D) m = 0 15., ( ) A) int i = 100 while ( 1) {i = i%100 + 1; if( i > 100) break; B) for( ; ; ) ; C) int k =1000; do{ + + k while ( k > =1000) ; 16. for( i = 1; i + + < 4; ) ;, i ( ) D) int s =36 A) 3 B) 4 C) 5 D) 17. a b int, b ( ) a = 1; b = 10; do {b - = a; a + + ; while( b < 0) ; A) 9 B) - 2 C) - 1 D) 8 while( s) ; - - s; 18., 3, 0, ( 1),( 2) { ong int num; scanf( % ld, &num) ; do if( ( 1) ) printf( % ld, num) ; scanf( % ld, &num) ; while( ( 2 ) ) ; ( 1 ) ) num% 100 /10 = = 3 B) num /100 % 10 = = 3 C) num% 10 /10 = = 3 D) num/10% 10 = = 3 ( 2 ) A)! num B) num > 0 = = 0 C)! num = = 0 D)! num! = 0 1. s = 1 + 2 + 3 + 4 + 5 s = 0 ; for( i = 1, i < = 5, i + + ) ; s = s + i;

C 2. s = 12345 s = 0 ; for( i = 1; i < = 5; i + + ) s = s* i; 1. ain( ) { nt x = 1, y = 1, i = 0; do 2. ain( ) { = x + y; y = x + y; i + + ; printf ( x = % d while( i < = 3) ; { nt x = 2, y = 10, i; 3. ain( ) for( i = x; i < = y; i + + ) ; printf( i = % d \ n, i) ; { nt x, y; 4. ain( ) y = % d \ n, x, y) ; fo ( y = 1, x = 1; y < = 50; y + + ) { f( x > = 10) break; if( x% 2 = = 1) { x + = 5; continue; x - = 3; printf( x = % d, y = % d \n, x, y) ; { nt j; fo ( j = 10; j > 3 ; j - - ) { f( j% 3) j - - ; 5. ain( ) j - = 2; printf( % 3d, j) ; 73

{ nt x = 1, y = 0; switch( x) { ase : switch( y) 6. ain( ) { ase 0: printf( * * 1* * \ n ) ; break; case 1: printf( * * 2* * \ n ) ; break; case 2: printf( * * 3* * \n ) ; { nt x = 0, y = 0; 7. ain( ) while( x < 15) y + +, x + = + + y; printf( % d, % d, y, x) ; { nt i, sum = 0; 8. ain( ) for( i = 0 ; i < 3; i + + ) printf( % d % d \ n, i, sum + = i) ; { i t i; 9. ain( ) fo ( i = 1; i < = 5; i + + ) { f( i% 2 ) printf( * ) ; else continue; printf( # ) ; printf( \ n ) ; { i t i; fo ( i = 1; i < = 5; i + + ) sw tch( i% 2 ) { ase 0: i + + ; printf( # ) ; break; case 1: i + = 2 ; printf( * ) ; default: printf( \ n ) ;

C 1. n, 2. x, 0,, 3., : 50, 1. 5 ; 50, 0. 6, 5 150, 5 1 4. 30 5, 75

6 1. int a[ 10] ;, a ( ), ( ) 2. int x[ 10] ;, x ( ), ( ), ( ), x ( ) 3. str Lei( ) 4. int a[ ] = {0, 1, 2, 3, 4, 5 ;, ( ) 5.,? ( ) 1. int a[ 10 ] ;, ( ) A) a( 9 ) B) a[ 9 ] C) a[ 10] D) a[ 3. 5] 2. ( ) A) int x[ 5] = {0, 1, 2, 3, 4, 5 ; B) int x[ ] = {0, 1, 2, 3, 4, 5 ; C) int x[ 5 ] = {0. 0 ; D) int x[ ] = ( 0, 1, 2, 3, 4, 5) ; 3. ( ) A) int x( 10) ; B) int x[ 5] = {0, 1, 2, 3, 4, 5 ; C) int n = 10; x[ n] ; D) int x[ ] = {0, 1, 2, 3, 4, 5 ; 4. a ( ) A) int a( 10) B) int n = 10, a[ n] ; C) int n; D) #define SIZE 10 scanf( % d, &n) ; int a[ SIZE] ; int a[ n] ; 5. ( ) A) int a[ 3] [ ] ; B) float a( 3, 4) ; C) double a[ 1] [ 4 ] ; D) float a( 3) ( 4) ; 6. : int a[ 3] [ 4] ;, ( ) A) a[ 2 ] [ 4 ] B) a[ 1, 3] C) a[ 1 + 1] [ 0] D) a( 2) ( 1) 7. ( ) A) int a[ 2] [ ] = { {1, 0, 1, {5, 2, 3 ;

C ( ) B) int a[ ] [ 3] = { {1, 2, 3, {4, 5, 6 ; C) int a[ 2 ] [ 4] = { {1, 2, 3, {4, 5, { 6 ; D) int a[ ] [ 3] = { {1, 0, 1 {, {1, 1 ; 8. ( ) A) ain( ) B) { loat a[ 10] = {0. 0 ; C) int i; D) for( i = 0; i < 3; i + + ) scanf( % d, &a[ i] ) ; E) for( i = 1; i < 10; i + + ) a[ 0] = a[ 0 ] + a[ i] ; F) printf( % f\ n, a[ 0 ] ) ; 9. str1, str2 ( ) A) if( str1 = = str2) ) if( if( str1 = str2 ) ) C) if( strcpy( str1, str2) ) D) if( strcmp( str1, str2 ) ) 10. : char array [ ] = China ;, array A) 4 ) 5 ) 6 ) 7 11. ( ) { nt a[ 6], i; f r( i = 1; i < 6; i + + ) { [ i] = 9* ( i - 2 + 4* ( i > 3) ) % 5; printf( % 2d, a[ i] ) ; A) - 4 0 4 0 4 B) - 4 0 4 0 3 C) - 4 0 4 4 3 D) - 4 0 4 4 0 12. s, ( ) A) char s[ 5] = { abc ; B) char s[ 5] = { a, b, c ; C) char s[ 5 ] = ; D) char s[ 5] = abcdef ; 13. ( ) char c[ 5] = { a, b, \0, c, \0 ; printf( % s, c) ; A) a b B) ab C) ab c D) abc 14. : char a[ ] = ABCDEF ; 77

char b[ ] = { ( ) A, B, C, D, E, F ; A) a b B) a b C) a b D) a b 15. : int i; int x[ 3 ] [ 3] = {1, 2, 3, 4, 5, 6, 7, 8, 9 ; ( ) for( i = 0; i < 3 ; i + + ) printf( % 2d, x[ i] [ 2 - i] ) ; A) 1 5 9 B) 1 4 7 C) 3 5 7 D) 3 6 9 16., k ( ) int k = 3, s[ 2] ; s[ 0] = k; k = s[ 1] * 10 ; A) B) 33 C) 30 D) 10 17., Hello! b ( ) A) char b[ 10] = { H, e, l, l, o,! ; B) char b[ 10] ; b = Hello! ; C) char b[ 10] ; strcpy( b, Hello! ) ; D) char b[ 10] = Hello! ; 18. ( ) char a[ 7] = abcdef ; char b[ 4] = ABC ; strcpy( a, b) ; printf( % c, a[ 5] ) ; A) ( ) B) \0 C) e D) f 19. s1 s2, ( ) A) if( s1 > s2) B) if( strcmp( s1 > s2) ) C) if( strcmp( s2, s1) > 0 ) D) if( strcmp( s1, s2 ) > 0) 20. ( ) A) B) C) = D) 21. ( ) { char ch[ 7 ] = { 12ab56 ; int i, s = 0;

for( = 0; ch[ i] > = 0 &&ch[ i] < = 9 ; i + = 2) s = 10* s + ch[ i] - 0 ; printf( % d \ n, s) ; C A) 1 B) 1256 C) 12ab56 D) 12 56 1., int n; int a[ n] ; 2. a : { nt a[ 10], i; for( i = 1 ; i < 10; i + + ) scanf( % d, &a[ i] ) ; 1. ain( ) { nt a[ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, s = 0, i; 2. ain( ) for( i = 0 ; i < 10; i + + ) if( a[ i] % 2 = = 0) s = s + a[ i] ; printf( s = % d, s) ; { nt a[ ] = {1, 3, 5, 2, 7 ; 3. ain( ) int b[ ] = { 5, 3, 9, 4, 6 ; int c[ 5], i; f r( i = 0; i < 5; i + + ) c[ i] = a[ i] * b[ i] ; for( i = 0 ; i < 5; i + + ) printf( % d, c[ i] ) ; { nt i, k, a[ 10 ], p[ 3] : k = 5; for ( i = 0 ; i < 10; i + + ) a[ i] = i; 79

4. ain( ) { for ( i = 0 ; i < 3; i + + ) p[ i] = a[ i* ( i + 1) ] ; for ( i = 0 ; i < 3; i + + ) k = p[ i] * 2; printf( % d \n, k) ; int y = 18, i = 0, j, a[ 8 ] ; do { a[ i] = y% 2; i + + ; y = y /2; while( y > = 1) ; for( j = i - 1; j > = 0; j - - ) printf( % d, a[ j] ) ; printf( \ n ) 1. 100, 2. n,,,,

C 3. n, m,,,, 7 1. ( ) ( ), ( ) ( ) 2., ( ) 3., ( ) 1. ( ) A) B) C) D), 2. ( ) A), B) return C), D), 3. ( ) A) B) C) D) 81

4., ( ) A) B) C) D) 5. ( ) A) double fun( int x, int y) B) double fun( int x; int y) C) double fun( int x, int y) ; D) double fun( int x, y) ; 6. ( ) A) ouble fun( int x, int y) { z = x + y; return z; C) un( x, y) { nt x, y; double z; z = x + y; return z; 7. ( ) B) un( int x, y) { nt z; return z; D) ouble fun( int x, int y) { ouble z; A) C z = x + y; return z; B) C, C) C D) C 8. ( ) A) B) C) D) 9. : fun( a + b, ( x, y), fun( n + k, d, ( a, b) ) ) ;, ( ) A) 3 B) 4 C) 5 D) 6 10. ( ) #include stdio. h func( int a, int b) { nt c; c = a + b; return c;

C { nt x = 6, y = 7, z = 8, r; r = func( x - -, y + +, x + y), z) ; printf( % d \ n, r) ; A) 11 B) 20 C) 21 D) 31 11. ( ) fun3( int x) { tatic int a = 3 ; a + = x; return( a) ; { nt k = 2, m = 1, n; n = fun3( k) ; n = fun3( m) ; printf( % d \ n, n) ; A) 3 B) 4 C) 6 D) 9 12. static char str[ ] = Beijing ;, printf( % d \ n, strlen ( strcpy( str, China ) ) ) ; ( ) A) 5 B) 7 C) 12 D) 14 13., fun ( ) { in a[ 50], n; fun(, &a[ 9] ) ; A) void fun( int m, int x[ ] ) B) void fun( int s, int h[ 41 ] ) C) void fun( int p, int * s) D) void fun( int n, int a) 14. ( ) void func1( int i) ; void func2( int i) ; char st[ ] = hello, friend! ; 83

void func1( int i) { p intf( % c, st[ i] ) ; if( i < 3) { i + = 2; func2 ( i) ; void func2( int i) { rintf( % c, st[ i] ) ; if( i < 3 ) { i + = 2; func1( i) ; { nt i = 0; func1( i) ; printf( \ n ) ; A) hello B) hel C) hlo D) hlm 1. oid num( ) { xtern int x, y; int a = 15, b = 10 ; x = a - b; y = a + b; int x, y; { nt a = 7, b = 5; x = a + b; y = a - b; num( ) ; printf( % d, % d \ n, x, y) ; 2. unc( int a, int b) { tatic int m = 0, i = 2; i + = m + 1; m = i + a + b; return m;

C { nt k = 4, m = 1, p; p = func( k, m) ; printf( % d,, p) ; p = func( k. m) ; printf( % d \ n, p) ; 8 1. : #define N 3 #define Y( n) ( ( N + 1) * n) : z = 2* ( N + Y( 5 + 1 ) ) ;, z ( ) A) B) 42 C) 48 D) 54 2. ( ) #include stdio. h #define SUB( X, Y) ( X) * Y { nt a = 3, b = 4; printf( % d, SUB( a + +, b + + ) ) ; A) 12 B) 15 C) 16 D) 20 3. ( ) #include stdio. h #define MIN( x, y) ( x) < ( y)? ( x) : ( y) { nt i, j, k; i = 10; j = 15; k = 10 * MIN( i, j) ; printf( % d \n, k) ; A) 15 B) 100 C) 10 D) 150 4., a ( ) #define SQR( X) X* X { nt a = 10, k = 2, m = 1; 85

a / = SQR( k + m) / SQR( k + m) ; printf( % d \n, a) ; A) 10 B) 1 C) 9 D) 0 5. ( ) #define MA( x) x* ( x - 1) { nt a = 1, b = 2; printf( % d \n, MA( 1 + a + b) ) ; A) 6 B) 8 C) 10 D) 12 9 1. ( ) int fun( int x, int y, int * cp, int * dp) { cp = x + y; * dp = x - y; { nt a, b, c, d; a = 30; b = 50; fun( a, b, &c, &d) ; printf( % d, % d \ n, c, d) ; A) 50, 30 B) 30, 50 C) 80, - 20 D) 80, 20 2. : int f( char * s) { har * p = s; while( * p! = \0 ) p + + ; return( p - s) ;, ( ) printf( % d \ n, f( goodbey! ) ) ;

C A) 3 B) 6 C) 8 D) 0 3. ( ) void prtv( int * x) { printf( % d \n, + + * x) ; { nt a = 25 ; prtv( &a) ; A) 23 B) 24 C) 25 D) 26 4. ( ) int funl( char * x) { har * y = x; while( * y + + ) ; return( y - x - 1 ) ; A) B) C) x y D) x y 5. ( ) sss( s, t) char * s, * t; { hile( ( * s) &&( * t) &&( * t + + = = * s + + ) ) ; return( * ( - - s) - * ( - - t) ) ; A) B) C) s t D) s t 6. ( ) { nt i, x[ 3] [ 3] = {9, 8, 7, 6, 5, 4, 3, 2, 1, * p = &x[ 1] [ 1] ; for( i = 0 ; i < 4; i + = 2) printf( % 3d, * ( p + i) ) ; A) 5 2 B) 5 1 C) 5 3 D) 9 7 7. : long int * p, a;, scanf ( ) 87

A) p = &a; scanf( % ld, p) ; B) = &a; scanf( % ld, p) ; C) scanf( % ld, p = &a) ; D) scanf( % ld, &a) ; 8. : char * st = how are you ;, ( ) A) har a[ 11 ], * p; strcpy( p = a + 1, &st[ 4] ) ; C) har a[ 11] ; strcpy( a, st) ; 9., ( ) { har * s = abcde ; s + = 2; printf( % ld \n, s) ; B) har a[ 11] ; strcpy( + + a, st) ; D) har a[ ], * p; strcpy( p = &a[ 1 ], st + 2) ; A) cde ) c ASCII ) c ) 10. : char str[ ] = ABCD, * p = str; printf( % d \ n, * ( p + 4) ) ; ( ) A) 68 B) 0 C) D D) 11. p1 p2 int, k int, ( ) A) k = * p1 + * p2; B) p2 = * k; C) p1 = p2; D) k = * p1 * ( * p2 ) ; 12. : int i, j = 7, * p = &i;, i = j; ( ) A) i = * p; ) * p = * &j; ) i = &j; ) i = * * p; 13. ( ) #include stdio. h #include string. h { har * p1 = abc, * p2 = ABC, str[ 50] = xyz ; strcpy( str + 2, strcat( p1, p2) ) ; printf( % s \ n, str) ;

C A) xyzabcabc B) zabcabc C) yzabcabc D) xyabcabc 14. ( ) { har a[ ] = programming, b[ ] = language ; char * p1, * p2; int i; p1 = a; p2 = b; fo ( i = 0; i < 7 ; i + + ) if * ( p1 + i) = = * ( p2 + i) ) printf( % c, * ( p1 + i) ) ; A) gm B) rg C ) or D) ga 15. x, pb, ( ) A) pb = &x B) pb = x; C) * pb = &x; D) * pb = * x 16. s ( ) char * s = \ \ Name \ \ Address \ n ; A) 19 B) 15 C) 18 D) 17. : int arr[ ] = {6, 7, 8, 9, 10 ; int * ptr; ( ) ptr = arr; * ( ptr + 2) + = 2; printf ( % d, % d \n, * ptr, * ( ptr + 2) ) ; A) 8, 10 B) 6, 8 C) 7, 9 D) 6, 10 18. int( * ptr) [ m] ;, ptr ( ) A) m B) m C) m D) m, 19., ( ) A) char st[ 4] [ 5] = { ABCDE ; B) char s[ 5 ] = { A, B, C, D, E ; 89

C) char * s; s = ABCDE ; D) char * s; scanf( % s, s) ; 20. ( ) void func( int * a, int b[ ] ) { b[ 0] = * a + 6 ; { t a, b[ 5] ; a = 0; b[ 0] = 3; func( &a, b) ; printf( % d \ n, b[ 0] ) ; A) 6 B) 7 C) 8 D) 9 21. ( ) int b = 2 ; int func( int * a) { + = * a; return( b) ; { nt a = 2, res = 2; res + = func( &a) ; printf( % d \ n, res) ; A) 4 B) 6 C) 8 D) 10 22. ( ) { nt a[ 3] [ 3 ], * p, i; p = &a[ 0] [ 0] ; for( i = 0; i < 9; i + + ) p[ i] = i + 1; printf( % d \ n, a[ 1] [ 2] ) ; A) 3 B) 6 C) 9 D) 23. ( ) A) int * p; B) int * s, k; scanf( % f, p) ; * s = 100;

C C) int * s, k; D) int * s, k; char * p, c; char * p, c; s = &k; p = &c; s = &k; p = &c; * p = a ; s = p; * s = 500; 24. ( ) { har arr[ 2] [ 4] ; strcpy( arr, you ) ; strcpy( arr[ 1 ], me ) ; arr[ 0] [ 3] = & ; printf( % s \ n, arr) ; A) you&me B) you C) me D) arr 10 1. ( ) #include stdio. h { nion { nt k; char i[ 2] ; * s, a; s = &a; s - > i[ 0] = 0x39 ; s - > i[ 1] = 0x38; printf( % x \n, s - > k) ; A) 3839 B) 3938 C) 380039 D) 390038 2. : typedef nion 91

struct { ong i; ate int k[ 5] ; char c; DATE; { nt cat; DATE max; DATE cow; double dog; too; ( ) printf ( % d, sizeof( struct date) + sizeof( max) ) ; A) 26 B) 30 C) 18 D) 8 3. ( ) A) #define printf C B) #define C, printf C) printf C, #define D) #define printf C 4. : ( struc st { nt n; struct st * next; ; static struct st a[ 3] = {5, &a[ 1 ], 7, &a[ 2 ], 9, \0, * p; p = &a[ 0] ; ) 6 A) p + + - > n B) p - > n + + C) (* p). n + + D) + + p - > n 5. ( ) struct abc { int a, b, c; ; { truct abc s[ 2] = { {1, 2, 3, {4, 5, 6 ; int t; t = s[ 0]. a + s[ 1]. b; printf( % d \n, t) ; A) 5 B) 6 C) 7 D) 8 6., a ( )

union UVB { har st[ 4] ; ; int i; long l; struct A { nt c; a; union UVB u; A) 4 B) 5 C) 6 D) 8 7. int b = 2;, ( b > > 2) /( b > > 1) ( ) A) 0 B) 2 C) 4 D) 8 8. printf( % d \ n, 12&012) ; ( ) A) 12 B) 8 C) 6 D) 012 C 9. C, ( ) A) fprintf B) fread C) fwrite D) fputc 11 1. C, ( ) A) \084 B) \ x43 C) ab D) \0 2. x y double, x = 1, y = x* 3 /2 ( ) A) 1 B) 2 C) 2. 0 D) 1. 5 3., ( ) A) int a[ ] = string ; B) int a[ 5] = {0, 1, 2, 3, 4, 5 ; C) vhst s = string ; D) int a[ ] = {0, 1, 2, 3, 4, 5 ; 4. a, 15 < a < 100 ( ) A) a > 100 a < 15 B) a < 100&&a > 15 C) a > = 100 a < = 15 D) a < = 100&&a > = 15 5. t double, t = 1, t + 5 ( ) A) 1 B) 6. 0 C) 2. 0 D) 1. 0 6. : 93

char s[ 10] ; s = abcd ; printf( % s \ n, s) ; ( ) ( ) A) abcd B) a C) abcd abcd D) 7. : int * * pp, * p, a = 10, b = 20 ; pp = &p; p = &a; p = &b; printf( % d \ n, * p, * * pp) ; ( ) A) 10, 20 B) 10, 10 C) 20, 10 D) 20, 20 8. : int u = 010, v = 0 x10, w = 10; printf( % d, % d, % d \ n, u, v, w) ; ( ) A) 8, 16, 10 B) 10, 10, 10 C) 8, 8, 10 D) 8, 10, 10 9. : char c1 = b, c2 = e ; printf( % d, % c \ n, c2 - c1, c2 - a + A ) ; ( ) A) 2, M B) 3, E C) 2, E D), 10. : char s[ 20] = programming, * ps = s; o ( ) A) ps2 B) s[ 2 ] C) ps[ 2 ] D) ps + 2, * ps 11. int i, j;, ( ) for( i = 5; i > 0; i - - ) for( j = 0; j < 4; j + + ) { A) 20 B) 25 C) 24 D) 30 12. : char * s1 = 12345, * s2 = 1234 ; printf( % d \ n, strlen( strcpy( s1, s2) ) ) ; ( ) A) 4 B) 5 C) 9 D) 10 13. : int a[ 10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, * p = a;

C a ( ) A) * p B) a[ 10] C) * a D) a[ p - a] 14. ( ) {c ar * s = 0121 ; int k = 0, a = 0, b = 0; do { + + ; if( k% 2 = = 0) { a = a + s[ k] - b = b + s[ k] - while( s[ k]! = \0 ) ; 0 ; continue; 0 ; a = a + s[ k] - 0 ; printf( k = % d a = % d b = % d \ n, k, a, b) ; A) k = 3 a = 2 b = 3 B) k = 3 a = 4 b = 2 C) k = 2 a = 4 b = 2 D) k = 2 a = 2 b = 3 15. ( ) { nsigned a = 32768 ; printf( a = % d \ n, a) ; A) a = 32768 B) a = 32767 C) a = - 32768 D) a = - 1 16. : float x; int a, b; switch ( ) A) switch( x) B) switch( x) { case 1. 0: printf( * \ n ) ; { case 1, 2: printf( * \n ) ; case 2. 0: printf( * * \ n ) ; case 3 : printf( * * \ n ) ; C) switch ( ab) D) switch ( ab) ; { case 1: printf( \ n ) ; { case 1: printf( * \n ) ; case 2: printf( * * \n ) ; case 2 : printf( * * \ n ) ; 17. : int x, y; char a, b, c; ( ) : 2 A B C x 1, y 2, a A, b B, c C ( ) 95

A) canf( x = % d y = % d, &x, &y) ; a = getchar( ) ; b = getchar( ) ; c = getchar( ) ; B) scanf( % d % d, &x, &y) ; a = getchar( ) ; b = getchar( ) ; c = getchar( ) ; C) scanf( % d% d% c% c% c, &x, &y, &a, &b, &c) ; D) scanf( % d% d% c% c% c% c% c% c, &x, &y, &a, &a, &b, &b, &c, &c) ; 18. ( ) #include stdio. h {c ar w[ ] [ 10] = { ABCD, EFGH, IJKL, MNOP ; int k; for ( k = 1; k < 3; k + + ) printf( % s \ n, &w[ k] [ k] ) ; A) ABCD B) ABCD C) EFG D) FGH FGH EFG JK KL KL IJ O M 19. : int a[ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, * p = a; 3 ( ) A) p = 2, * ( p) B) p = 2, * p C) p + = 3, * kp D) p + = 2, * p 20., x ( ) a = b = c = 0 ; x = 35; if! a) x - - ; e se if( b) x = 2 ; e se if( c) x = 3 ; else x = 4; A) 34 ) 4 ) 35 ) 3 21., ( ) A) < = B) = C) % D) && 22. : int w[ 2] [ 3], (* pw) [ 3] ; pw = w; w ( ) A) * ( w[ 0] 2) B) * ( pw1) [ 2 ] C) pw[ 0] [ 0] D) * ( pw[ 1] [ 2] )

C 23. : char str[ ] = ab \ n \012 \ \ \ ; printf( % d, strlen( str) ) ; ( ) A) 3 B) 4 C) 6 D) 12 24. : strcat( strcpy( str1, str2), str3 ) ( ) A) str1 str2, str3 B) str1 str2, str3 C) str2 str1, str3 str1 D) str2 str1, str1 str3 25. C, ( ) A) C,, B) C, C), D) C 26. ( ) A) C,,, B) C, C) C, D) C, register 27. ( ) #include stdio. h subl( char a, char b) { char c; c = a; a = b; b = c; sub2 ( char* a, char b) { char c; c = * a; * a = b; b = c; sub3 ( char* a, char* b) { char c; c = * a; * a = * b; * b = c; { har a, b; a = A ; b = B ; sub3( &a, &b) ; putchar( a) ; putchar( b) ; a = A ; b = B ; sub2( &a, b) ; putchar( a) ; putchar( b) ; a = A ; b = B ; sub1( a, b) ; putchar( a) ; putchar( b) ; A) BABBAB B) ABBBBA C) BABABA D) BAABBA 28. : 97

struct sk {int a; float b; data, * p; p = &data;, data a ( ) A) ( * p). data. a B) ( * p). a C) p - > data. a D) p. data. a 29. ( ) A) enum a = {one, two, three ; B) enum a { one, two, three ; C) enum a = { one, two, three ; D) enum a { one, two, three ; 1. a C ( bc ) 2. a = 10, b = - 10,! a + b ( ) 3.,, ( ) 4. fun void, : #define M 50 { i t a[ M] ; fun( a) ; fun, : ( ), ( ), ( ) ( : q, ) 5. fun s : 6354abc, ( ) long fun( char s[ ] ) { ong n; int sign; for( ; isspace( * s) ; s + + ) ; sign = ( * s = = - )? - 11 ;

C if( * s = = - ) s + + ; for( n = 0 ; isdigit( * s) ; s + + ) n = 10* n + ( * s - 0 ) ; return ( sign* n) ; 6. w xw, n,, void fun ( char * w, char x, int * n) { nt i, p; p = 0; w[ * n] = x; wh le ( x > w[ p] ) ( ; for( i = * n; i > p; i - - ) w[ i] = ( ; w[ p] = x; * n + + ; 7. fun1 : fun1 ( &a, &b, &c) ;, a, b, c, a vo d fun2 ( int * x, int * y) { nt t; t = * x; * x = * y; * y = t; v id fun1 ( int * pa, int * pb, int * pc) { f( * pa < * pb) fun2( ; if( * pa < * pc) fun2 ( ; if( * pb < * pc) fun2( ; 1. ( ) A) C B) C) 12 D) 99

2. ( ) A) 5E2. 0 B) E - 3 C). 2E0 D) 1. 3E 3. ( ) A) long B) 2Test C) 3Dmax D) A. dat 4. A ASCII 65, a ASCII 97, \101 ( ) A) A B) a C) e D) 5. ( ) A) n = ( i = 2, + + i) ; B) j + + ; C) + + ( i + 1) ; D) x = j > 0 ; 6. a b double, a = 5. 5, b = 2. 5, ( int) a + b / b ( ) A) 6. 500 000 B) 6 C) 5. 500 000 D) 6. 000 000 7. i, j, k int, 1, 2, 3 < >, i 1, j 2, k 3, ( ) A) scanf( % 2d% 2d% 2d, &i, &j, &k) ; B) scanf( % d % d % d, &i, &j, &k) ; C) scanf( % d, % d, % d, &i, &j, &k) ; D) scanf( i = % d, j = % d, k = % d, &i, &j, &k) ; 8. 3xn C ( ) 2 x - 1 A) 3* x^n / ( 2* x - 1) B) 3* x* * n /( 2* x - 1) C) 3* pow( x, n) * ( 1 / ( 2* x - 1 ) ) D) 3* pow( n, x) / ( 2* x - 1) 9. : long x = - 123456L;, x ( ) A) printf( x = % d \ n, x) ; B) printf( x = % ld \n, x) ; C) printf( x = % 8dL \n, x) ; D) printf( x = % LD \n, x) ; 10. : { nt k = 2, i = 2, m; m = ( k + = i* = k) ; printf( % d, % d \ n, m, i) ; ( )

C A) 8, 6 B) 8, 3 C) 6, 4 D) 7, 4 11. : int x = 3, y = 4, z = 5;,! ( x + y) + z - 1 &&y + z /2 ( ) A) 6 B) 0 C) 2 D) 1 12. y = 1, x > 0, 0, x = 0, - 1, x < 0 x y ( ) A) if( x > 0) y = 1; else if( x = = 0) y = 0 ; else y = - 1; B) y = 0; if( x > 0) y = 1; else if( x < 0 ) y = - 1; C) y = 0; if( x > = 0) if( x > 0 ) y = 1; else y = - 1; D) if( x > = 0) if( x > 0 ) y = 1; else y = 0 ; else y = - 1; 13., k = n + + ( ) A) k = n, n = n + 1 B) n = n + 1, k = n C) k = + + n D) k + = n + 1 14. : 10 4,, : ain( ) { nt n, k; float score, sum, ave; sum = 0. 0; for( n = 1; n < = 10; n + + ) { o ( k = 1; k < = 4; k + + ) { scanf( % f, &score) ; sum + = score; ave = sum /4. 0 ; printf( NO% d: % f\ n, n, ave) ;, ( ) A) sum = 0. 0; B) sum + = score; C) ave = sum/4. 0; D) printf( NO% d: % f\ n, n, ave) ; 15. : int n = 0, p; 101

do { scanf( % d, &p) ; n + + ; while( p! = 12345 &&n < 3) ; do... while ( ) A) p 12345 n 3 B) p 12345 n 3 C) p 12345 n 3 D) p 12345 n 3 16. : { nt a = 15, b = 21, m = 0; sw tch( a% 3) { ase 0: m + + ; break; case 1 switch( b% 2) { efault: m + + ; printf( % d \ n, m) ; ( ) ( ) case 0: m + + ; break; A) 1 B) 2 C) 3 D) 4 17. C,, ( ) A) void B) int C) float D) double 18. : int n = 2, * p = &n, * q = p;, A) p = q; B) * p = * q; C) n = * q; D) p = n; 19. : float fun( int x, int y) { return( x + y) ; { nt a = 2, b = 5, c = 8; printf( % 3. 0f \n, fun( ( int) fun( a + c, b), a - c) ) ; ( ) A) 8 B) 9 C) 7 D) 6 20. :

void fun( char * c, int d) { c = * c + 1 ; d = d + 1; printf( % c, % c,, * c, d) ; { har a = A, b = a ; fun( &b, a) ; printf( % c, % c \ n, a, b) ; ( ) A) B, a, B, a B) a, B, a, B C) A, b, A, b D) b, B, A, b C 13 : 1. sort a void sort( int a[ ], int n) { nt i, j, t; for( i = 0; i < n - 1; i + + ) for( j = i + 1 ; j < n; j + + ) if( a[ i] < a[ j] ) { t = a[ i] ; a[ i] = a[ j] ; a[ j] = t; { i t aa[ 10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, i; sort( &aa[ 3], 5) ; for( i = 0 ; i < 10; i + + ) printf( % d,, aa[ i] ) ; printf( \ n ) ; ( ) A) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, B) 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, C) 1, 2, 3, 8, 7, 6, 5, 4, 9, 10, D) 1, 2, 10, 9, 8, 7, 6, 5, 4, 3, 2. : int f( int n) 103

{ f ( n = = 1 ) return 1; else return f( n - 1) + 1; { nt i, j = 0 ; for( i = 1 ; i < 3; i + + ) j + = f( i) ; printf( % d \n, j) ; ( ) A) 4 B) 3 C) 2 D) 1 3. : { har a[ ] = { a, b, c, d, e, f, g, h, \0 ; int i, j; i = sizeof( a) ; j = strlen( a) ; printf( % d, % d \ n, i, j) ; ( ) A) 9, 9 B) 8, 9 C) 1, 8 D) 9, 8 4. reverse a : void reverse( int a[ ], int n) { nt i, t; for( i = 0 ; i < n /2; i + + ) { t = a[ i] ; a[ i] = a[ n - 1 - i] ; a[ n - 1 - i] = t; { nt b[ 10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; int i, s = 0; reverse( b, 8) ; for( i = 6 ; i < 10; i + + ) s + = b[ i] ; printf( % d \n, s) ; ( ) A) 22 B) 10 C) 34 D) 30 5. :

C { nt aa[ 4 ] [ 4] = { {1, 2, 3, 4, {5, 6, 7, 8, {3, 9, 10, 2, {4, 2, 9, 6 ; int i, s = 0; for( i = 0 ; i < 4; i + + ) s + = aa[ i] [ 1 ] ; printf( % d \n, s) ; ( ) A) 11 B) 19 C) 13 D) 20 6. : #include string. h { har * p = abcde \0fghjik \0 ; printf( % d \n, strlen( p) ) ; ( ) A) 12 B) 15 C) 6 D) 5 7. type1. h : #define N 5 #define M1 N* 3 : #include type1. h #define M2 N* 2 { nt i; i = M1 + M2; printf( % d \ n, i) ; ( ) A) 10 B) 20 C) 25 D) 30 8. : #include stdio. h { ILE * fp; int i = 20, j = 30, k, n; fp = fopen( d1. dat, w ) ; fprintf( fp, % d \ n, i) ; fprintf( fp, % d \n, j) ; 105

fclose( fp) ; fp = fopen( d1. dat, r ) ; fscanf( fp, % d% d, &k, &n) ; printf( % d% d \n, k, n) ; fclose( fp) ; ( ) : A) 20 30 B) 20 50 C) 30 50 D) 30 20 9. ( ) A), B), fclose C) fread, D) FILE 10. : #include string. h main( int argc, char * argv[ ] ) { nt i, len = 0; for( i = 1; i < argc; i + + ) len + = strlen( argv[ i] ) ; printf( % d \ n, len) ; ex1. exe ex1 abcd efg 10 < > ( ) A) 22 B) 17 C) 12 D) 9 11. : int fa( int x) { return x* x; int fb( int x) { return x* x* x; int f( int ( * f1) ( ), int ( * f2) ( ), int x) { return f2 ( x) - f1( x) ; { nt i;

C i = f( fa, fb, 2) ; printf( % d \ n, i) ; ( ) A) - 4 B) 1 C) 4 D) 8 12. : int a = 3 ; { nt s = 0 ; { int a = 5; s + = a + + ; s + = a + + ; printf( % d \ n, s) ; ( ) A) 8 B) 10 C) 7 D) 11 13. : void ss( char * s, char t) { hile( * s) { f( * s = = t) * s = t - a + A ; s + + ; { har str1[ 100] = abcddfefdbd, c = d ; ss( str1, c) ; printf( % s \n, str1) ; ( ) A) ABCDDEFEDBD B) abcddfefdbd C) abcaafefaba D) Abcddfefdbd 14. : struct STU { char num[ 10] ; float score[ 3 ] ; { struct STU s[ 3] = { { 20021, 90, 95, 85, { 20022, 95, 80, 75, { 20023, 100, 95, 90, * p = s; int i; float sum = 0 ; for( i = 0 ; i < 3; i + + ) 107

sum = sum + p - > score[ i] ; printf( % 6. 2f\ n, sum) ; ( ) A) 260. 00 B) 270. 00 C) 280. 00 D) 285. 00 15. : struct sk { nt a; float b; data; int * p; p data a, ( ) A) p = &a; B) p = data. a; C) p = &data. a; D) * p = data. a 16. : #include stdlib. h struct NODE {int num; struct NODE * next; { truct NODE * p, * q, * r; p = ( struct NODE * ) malloc( sizeof( struct NODE) ) ; q = ( struct NODE * ) malloc( sizeof( struct NODE) ) ; r = ( struct NODE * ) malloc( sizeof( struct NODE) ) ; p - > num = 10 ; q - > num = 20; r - > num = 30 ; p - > next = q; q - > next = r; printf( % d \ n, p - > num + q - > next - > num) ; ( ) A) 10 B) 20 C) 30 D) 40 17. : typedef int * INTEGER INTEGER p, * q; ( ) A) p int B) p int