当前位置:网站首页>3. Sequential structure multiple choice questions
3. Sequential structure multiple choice questions
2022-06-25 14:57:00 【--988】
3. The output of the following program is (A).
1. In the format C Call in language printf Attention should be paid to when outputting , In the format control string , The format description and the number of output items must be the same . If the number of format descriptions is less than the number of output items , The extra output items will ( ); If the number of format descriptions is more than the number of output items , For redundant formats, the indefinite value will be output ( or 0).(A)
A. No output
B. Output space
C. Output as usual
D. Output variable value or 0
2. stay scanf Function format control , The format description type should match the input type one by one . If the type doesn't match , System (B ).
A. Not accepted
B. No error message is given , But it is impossible to get the correct information and data
C. Can accept correct input
D. Give error message , Do not accept input
#include<stdio.h>
int main(void)
{
int i=010,j=10,k=0x10;
printf("%d,%d,%d\n",i,j,k);
return 0;
}
A.8,10,16
(i It's octal. ,j It's decimal ,k It's hexadecimal )
4. It has the following definitions
int x=10,y=5,z;
printf("%d\n",z=(x+=y,x/y));
The output of is (3).
Operators of the same priority , The operation order is determined by the combination direction .
Just remember :!> Arithmetic operator > Relational operator >&&>||> Assignment operator
, The combining direction of the comma operator is from left to right , The final result is determined by the last expression .
5. Write the output of the following program (C).
#include<stdio.h>
int main(void)
{
int i,j;
i=20;
j=(++i)+i;
printf("%d",j);
i=13;
printf("%d %d ",i++,i);
return 0;
}
C.42 13 13
front ++: to ++ operation , And then I'll take part in the calculation .
after ++: Take part in the calculation first , Proceed again ++ operation .( Self increase is similar to self decrease )
6.printf The formatter is used in the function "%4s", And the numbers 4 Stands for the output string 4 Column . If the string length is greater than 4, Then all the characters will be output from left to right according to the original character length ; If the string length is less than 4, Then the output mode is ( C).
A. Output the string from the left , Fill in the right space
B. Output all from left to right according to the original character length
C. Right align to output this character , Left padding
D. Output error message
7. The output of the following program is (D ).
int main(void)
{ intk=11;
printf("k=%d,k=%o,k=%x\n",k,k,k);
return 0; }
A.k=11,k=12,k=11
B.k=11,k=13,k=13
C.k=ll,k=013,k=Oxb
D.k=11,k=13,k=b
8. Assume w、x、y、z、m Are all int Type variable , Then run the following program segments ,m The value of is ( D).
w=1; x=2; y=3; z=4;
m=(w<x)?w:x; m=(m<y)?m:y; m=(m<z)?m:z;
A.4
B.3
C.2
D.1
The conditional operator is C The only binomial operator in a language , The grammar format is : expression 1? expression 2: expression 3, The evaluation rule is : If the expression 1 The value of is true , The expression 2 As the value of the entire conditional expression , Otherwise, the expression 3 As the value of the entire conditional expression .
9. Suppose you enter... From the keyboard 23456< enter >, The output of the following program is ( C).
#include<stdio.h>
int main (void )
{ int m,n;
scanf("%2d%3d", &m,&n);
printf("m=%d n=%d\n",m,n);
return 0;
}
A.m=23 n=45
B.m=234 n=56
C.m=23 n=456
D. Statement has errors
10. Known characters a Of ASCII Decimal code is 97, The output result after executing the following program segments is (D ).
char ch:int k:
ch='a'; k=12;
printf("%c, %d,",ch,ch,k);
printf("k=%d\n",k);
A. The dependent variable type does not match the type of the format descriptor, and the output has no fixed value
B. The output item does not match the number of format descriptors , The output is zero or indefinite
C.a,97,12k=12
D.a,97,k=12
边栏推荐
- Output 0 ~ n digits and output multiple times
- Uniapp icon configuration
- Uniapp cloud packaging app
- High precision addition
- 15 -- 最接近原点的 K 个点
- JS to add elements to the header, or tail of an array
- Gif动图如何裁剪?收下这个图片在线裁剪工具
- Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment
- The best time to buy and sell stocks
- Golang channel reading data
猜你喜欢
90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟
Js- get the mouse coordinates and follow them
使用sphinx根据py源文件自动生成API文档
定位position(5种方式)
Judging the number of leap years from 1 to N years
2022年广东高考分数线出炉,一个几家欢喜几家愁
JS get the height and width corresponding to the box model (window.getcomputedstyle, dom.getboundingclientrect)
Kubernetes understands kubectl/ debugging
Iterator failure condition
Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password
随机推荐
Basic usage of markdown (plain text and grammar)
[untitled] the CMD command window displays' NPM 'which is not an internal or external command
Clinical chemistry | zhangjianzhong / Xu Jian develop single cell precision diagnosis and treatment technology for Helicobacter pylori
NBD Network Block Device
多张动图怎样合成一张gif?仅需三步快速生成gif动画图片
QT opens the print dialog box in a text editor
Async await to achieve sleep waiting effect
Go closure usage example
Kubernetes understands kubectl/ debugging
Biscuit distribution
Why should the coroutine be set to non blocking IO
Qt: Pro project file
Golang channel reading data
开餐馆
New title of PTA
从0到1完全掌握 XSS
[untitled]
JS determines whether two values are equal, and compares any two values, including array objects
QT database connection deletion
Kubernetes 理解kubectl/调试