当前位置:网站首页>[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
边栏推荐
- Database SQL language practice
- Can you make a JS to get the verification code?
- 光量子里程碑:6分钟内解决3854个变量问题
- redis 哨兵集群搭建
- 语法泛化三种可行方案介绍
- 【Day03_0420】C语言选择题
- "Recursive processing of subproblems" -- judging whether two trees are the same tree -- and the subtree of another tree
- The number of weeks of Oracle last year and this year, with the start time and end time
- [the most complete and detailed] ten thousand words explanation: activiti workflow engine
- Kingbasees SQL language reference manual of Jincang database (8. Functions (XI))
猜你喜欢

Kingbasees SQL language reference manual of Jincang database (7. Conditional expression)

Establishment of log collection and analysis platform-1-environment preparation

Embedded sharing collection 14

【pytorch】微调技术

YOLOv6:又快又准的目标检测框架开源啦

Using dynamic libraries in VS

YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors

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

【(SV && UVM) 笔试面试遇到的知识点】~ phase机制

VRRP protocol and experimental configuration
随机推荐
Kingbasees SQL language reference manual of Jincang database (7. Conditional expression)
Establishment of log collection and analysis platform-1-environment preparation
CV (1)- Introduction
Flex layout
【Day_07 0425】合法括号序列判断
【Day02_0419】C语言选择题
递归函数中 有两个递归入口的时间复杂度
Traversal of the first, middle, and last order of a binary tree -- Essence (each node is a "root" node)
Database SQL language practice
Mysql45 speak in simple terms index
Understanding the mathematical essence of machine learning
Sequential action localization | fine grained temporal contrast learning for weak supervised temporal action localization (CVPR 2022)
Knowledge precipitation I: what does an architect do? What problems have been solved
【Day_01 0418】删除公共字符串
JS的调用方式与执行顺序
Convolutional neural network (IV) - special applications: face recognition and neural style transformation
WebAPI整理
Webapi collation
Servlet无法直接获取request请求中的JSON格式数据
【Day_05 0422】统计回文
