当前位置:网站首页>[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
边栏推荐
- Optical quantum milestone: 3854 variable problems solved in 6 minutes
- 逆序打印链表
- 【pytorch】CNN实战-花朵种类识别
- Servlet无法直接获取request请求中的JSON格式数据
- 【Day_06 0423】不要二
- Traversal of the first, middle, and last order of a binary tree -- Essence (each node is a "root" node)
- [day_020419] sort subsequence
- Knowledge precipitation I: what does an architect do? What problems have been solved
- Byte interview question - judge whether a tree is a balanced binary tree
- 2022年下半年系统集成项目管理工程师(软考中级)报名条件
猜你喜欢

Excitation method and excitation voltage of hand-held vibrating wire vh501tc acquisition instrument

Kingbasees SQL language reference manual of Jincang database (6. Expression)

Embedded sharing collection 15

Unity2d animator cannot create transition

Docking wechat payment (II) unified order API

CV (1)- Introduction

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

The time complexity of two recursive entries in a recursive function

Swift basic FileManager (file management)

Age is a hard threshold! 42 years old, Tencent level 13, master of 985, looking for a job for three months, no company actually accepted!
随机推荐
Latex同时合并表格的多行多列
Sequential action localization | fine grained temporal contrast learning for weak supervised temporal action localization (CVPR 2022)
Leetcode:940. How many subsequences have different literal values
【Day05_0422】C语言选择题
H. Take the Elevator 贪心
L. Link with Level Editor I dp
TPS Motion(CVPR2022)视频生成论文解读
How to divide the disks under the devices and drives in win10 new computer
Using dynamic libraries in VS
英语句式参考纯享版 - 定语从句
Optical quantum milestone: 3854 variable problems solved in 6 minutes
字节面试题——判断一棵树是否为平衡二叉树
[highly available MySQL solution] centos7 configures MySQL master-slave replication
英语句式参考纯享版 - 状语从句
Knowledge precipitation I: what does an architect do? What problems have been solved
分布式 | 实战:将业务从 MyCAT 平滑迁移到 dble
Webapi collation
Mysql45 talking about logging system: how does an SQL UPDATE statement execute?
Amd zen4 game God u reached 208mb cache within this year, which is unprecedented
知识沉淀一:架构师是做什么?解决了什么问题
