当前位置:网站首页>[day05_0422] C language multiple choice questions
[day05_0422] C language multiple choice questions
2022-07-26 06:12:00 【On the Bank of Anhe Bridge】
【Day05_0422】C Language multiple choice questions
1. The output of the following program is ?(D)
int x = 1;
do {
printf("%2d\n", x++);
} while (x--);
A 1
B No output
C 2
D Fall into a dead cycle
2. Definition char dog[]=“wang\0miao”; that sizeof(dog) And strlen(dog) What are the differences :(A)
A 10,4
B 4,4
C 9,9
D 9,4
analysis :
\0 Occupy a byte space ,\ Indicates the escape character
The compiler will add a \0
strlen Function encountered \0 Stop counting after
3. The print result of the following program is ?(D)
char p1[15] = "abcd", * p2 = "ABCD", str[50] = "xyz";
strcpy(str + 2, strcat(p1 + 2, p2 + 1));
printf("%s", str);
A xyabcAB
B abcABz
C ABabcz
D xycdBCD
E Operation error
analysis :
4. The output of the following program is (B)
#include<iostream.h>
void main() {
int n[][3] = {
10,20,30,40,50,60 };
int(*p)[3];
p = n;
cout << p[0][0] << "," << *(p[0] + 1) << "," << (*p)[2] << endl;
}
A 10,30,50
B 10,20,30
C 20,40,60
D 10,30,60
analysis :
p Represents a pointer to an array with three integer elements
p[0] Equivalent to *(p+0), Represents the second part of an array 0 That's ok , That is to say 0 Array name of a one-dimensional array , That is to say, No 0 Address of the first element of a one-dimensional array
5. What is correct in the following statement is (B).
A C++ In program main() Functions must be placed at the beginning of the program
B C++ The entry function of the program is main function
C stay C++ In the program , The function to be called must be in main() Function
6. The running result of the following program is :(D)
#include<iostream>
using namespace std;
char fun(char x, char y) {
if (x < y)
return x;
return y;
}
int main() {
int a = '1', b = '1', c = '2';
cout << fun(fun(a, b), fun(b, c));
return 0;
}
A Operation error
B 2
C 3
D 1
7. about int* pa[5]; Description of , Which of the following is true (A)
A pa Is a person with 5 Pointer array of elements , Each element is a int Pointer to type ;
B pa Is a pointer to an array , The array pointed to is 5 individual int Element of type ;
C pa[5] The... Of a number 5 The value of the elements ;
D pa Is a pointer to the... In an array 5 Pointers to elements , The element is int Variable of type
8. The next two structures , stay #pragma pack(4) and #pragma pack(8) Under the circumstances , The sizes of the structures are (C)
struct One {
double d;
char c;
int i;
}
struct Two {
char c;
double d;
int i;
}
A 16 24,16 24
B 16 20,16 20
C 16 16,16 24
D 16 16,24 24
9. Which of the following pointer expressions can be used to reference array elements a[i] [j] [k] [l]()
A (((a+i)+j)+k)+l)
B *(*(*(*(a+i)+j)+k)+l)
C (((a+i)+j)+k+l)
D ((a+i)+j+k+l)
His answer : ( error )
right key : B
analysis :
10. Composed of multiple source files C Program , Edited 、 Preprocessing 、 compile 、 Linking and other stages will generate the final executable . Which of the following stages can you find that the called function is undefined ?(C)
A Preprocessing
B compile
C link
D perform
analysis :
Preprocessing : Header file expansion , Macro replace , Processing precompiled instructions , To comment, etc
compile : Check for grammatical errors , Generate assembly code
assembly : Translate the compiled assembly instructions into the corresponding binary files
link : Splice multiple object files into one , Solve the address problem
边栏推荐
- Can you make a JS to get the verification code?
- 对接微信支付(二)统一下单API
- Kingbasees SQL language reference manual of Jincang database (8. Function (10))
- VRRP protocol and experimental configuration
- 时序动作定位 | 用于弱监督时态动作定位的细粒度时态对比学习(CVPR 2022)
- [(SV & UVM) knowledge points encountered in written interview] ~ phase mechanism
- Leetcode:940. How many subsequences have different literal values
- 卸载手机自带APP的操作步骤
- Kingbasees SQL language reference manual of Jincang database (7. Conditional expression)
- 【pytorch】CNN实战-花朵种类识别
猜你喜欢

H. Take the elevator greedy

RNN循环神经网络

Registration conditions for system integration project management engineer (intermediate level of soft exam) in the second half of 2022

Etcd database source code analysis - cluster membership changes log

Traversal of the first, middle, and last order of a binary tree -- Essence (each node is a "root" node)

Redis sentinel cluster setup

Kingbasees SQL language reference manual of Jincang database (10. Query and sub query)

Solutions to the failure of copy and paste shortcut keys

Viewing the technology stack of distributed system from the crash report of station B
C language explanation series - comprehensive exercises, guessing numbers games
随机推荐
知识沉淀一:架构师是做什么?解决了什么问题
Taobao pinduoduo Tiktok 1688 Suning taote jd.com and other keyword search commodity API interfaces (keyword search commodity API interface, keyword search commodity list interface, classification ID s
Servlet无法直接获取request请求中的JSON格式数据
Optical quantum milestone: 3854 variable problems solved in 6 minutes
【Day_07 0425】合法括号序列判断
Embedded sharing collection 15
Leetcode 42. rainwater connection
Cdga | how to build data asset catalogue?
【Day_05 0422】统计回文
【Oracle SQL】计算同比与环比(列转行进行偏移)
K. Link with Bracket Sequence I dp
Byte interview question - judge whether a tree is a balanced binary tree
Mobile web
Swift basic FileManager (file management)
[(SV & UVM) knowledge points encountered in written interview] ~ phase mechanism
How to divide the disks under the devices and drives in win10 new computer
Excitation method and excitation voltage of hand-held vibrating wire vh501tc acquisition instrument
Detailed explanation of the whole process of coding's pressure measurement operation
Calling mode and execution sequence of JS
数据库sql语言实战
