当前位置:网站首页>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
边栏推荐
- Why should the coroutine be set to non blocking IO
- Heavyweight! The domestic IDE is released and developed by Alibaba. It is completely open source! (high performance + high customization)
- Design and implementation of thread pool
- 开餐馆
- ‘make_ unique’ is not a member of ‘std’
- Remove interval (greedy)
- Get the parameters in the URL and the interchange between parameters and objects
- QT database connection
- JGG | 河北大学杜会龙组综述植物泛基因组学研究
- From 408 to independent proposition, 211 to postgraduate entrance examination of Guizhou University
猜你喜欢

Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password

Character encoding minutes

Heavyweight! The domestic IDE is released and developed by Alibaba. It is completely open source! (high performance + high customization)

Open a restaurant

JS floating point multiplication and division method can not accurately calculate the problem

Uniapp icon configuration

JGG | 河北大学杜会龙组综述植物泛基因组学研究

Clinical chemistry | zhangjianzhong / Xu Jian develop single cell precision diagnosis and treatment technology for Helicobacter pylori

15 -- k points closest to the origin

15 -- 最接近原点的 K 个点
随机推荐
HMS Core机器学习服务实现同声传译,支持中英文互译和多种音色语音播报
In 2022, the score line of Guangdong college entrance examination was released, and several families were happy and several worried
开餐馆
Basic usage of markdown (plain text and grammar)
Is it normal to dig for money? Is it safe to open a stock account?
Automatic correlation between QT signal and slot
SPARQL learning notes of query, an rrdf query language
QT opens the print dialog box in a text editor
挖财是正规的吗?股票开户安全吗?
[deep learning] multi task learning of multiple datasets data sets missing labels
The best time to buy and sell stocks
QT pop up open file dialog box QFileDialog
JS get the height and width corresponding to the box model (window.getcomputedstyle, dom.getboundingclientrect)
Qlogsystem log system configuration use
How to view the Chrome browser plug-in location
Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products
Function of getinstance() method
JS to verify whether the string is a regular expression
Dmsetup command
Remove interval (greedy)