当前位置:网站首页>[day06_0423] C language multiple choice questions
[day06_0423] C language multiple choice questions
2022-07-26 06:12:00 【On the Bank of Anhe Bridge】
【Day06_0423】C Language multiple choice questions
1. Decimal variables i The value of is 100, So octal variables i The value of is :(C)
A 146
B 148
C 144
D 142
2. The output after executing the following statement is ()
int I = 1;
if (I <= 0)
{
printf("****\n");
}
else
{
printf("%%%%\n");
}
A %%
B ****
C There is a grammatical error , Cannot execute correctly
D %%%%
His answer : D ( error )
right key : A
analysis :
Every two % For a group , The first represents control , because % No. followed by a specific character can be used for format control , and % Followed by the second % No special meaning , So the second in each group % Will be output .
eg.%Q, Will directly output characters Q
3. For the following C One of the things that language statements describe correctly is (C)
char (*p)[16]
A p It's a length of 16 Character pointer array of
B p Is included 16 Character string
C p Yes, the pointing length is 16 Pointer to the character array of
D p It's a length of 16 Array of characters
4. Array a The definition statement of is “float a[3][4];”, The following (D ) Is an incorrect reference method to an array element .
A a[i] [j]
B *(a[i]+j)
C *(*(a+i)+j)
D *(a+i*4+j)
5. The output of the following program is (d)
#include < iostream.h>
#define SQR(A) A*A
void main() {
int x = 6, y = 3, z = 2;
x /= SQR(y + z) / SQR(y + z);
cout < < x < < endl;
}
A 5
B 6
C 1
D 0
analysis :
Right side of the formula :3+2*3+2/3+2*3+2=3+6+0+6+2=17
6/17=0
6. When n=5 when , The return value of the following function is :()
int foo(int n) {
if (n < 2) {
return n;
}
else
return 2 * foo(n - 1) + foo(n - 2);
}
A 5
B 11
C 29
D 10
analysis :
Calculate recursion problem , From the bottom up
f5=2f4+f3
f4=2f3+f2
f3=2f2+f1
f2=2f1+f0;
f1=1;
f0=0;
Then push up , obtain f5 Result
7. The following for C Linguistic ” The pointer “ What's wrong with the description is :(D)
A 32 The length of any type of pointer in a bit system is 4 Bytes
B The data type of the pointer declares the data type that the pointer actually points to the content
C A wild pointer is a pointer to an unallocated or freed memory address
D When using free After releasing a pointer content , The value of the pointer variable is set to NULL
8. Array is defined as ”int a[4][5];”, quote ”*(a+1)+2″ Express ()( From 0 OK, let's start )
A a[1][0]+2
B a Array number 1 Xing di 2 The address of the column element
C a[0][1]+2
D a Array number 1 Xing di 2 Value of column element
analysis :
No dereference does not mean value , Address
9. There's a structure like this : Excuse me at 64 Bit compiler sizeof(struct A) What's the calculated size ?()
struct A {
long a1;
short a2;
int a3;
int* a4;
};
A 24
B 28
C 16
D 18
His answer : A ( correct )
right key : A
analysis :
64 Bit compiler , therefore int* Occupy 8 Bytes , The default alignment number is 8 Calculation
10. The result of the operation is ?(D)
#include <iostream>
using namespace std;
int f(int n) {
if (n == 1)
return 1;
else
return (f(n - 1) + n * n * n);
}
int main() {
int s = f(3);
cout << s << endl;
return 0;
}
A 8
B 9
C 27
D 36
analysis :
Calculation method of recursive problem , Calculate from the bottom to the top
f3=f2+333
f2=f1+222
f1=1
边栏推荐
- [the most complete and detailed] ten thousand words explanation: activiti workflow engine
- Latex merges multiple rows and columns of a table at the same time
- [2023 Jerry technology approval test questions in advance] ~ questions and reference answers
- The time complexity of two recursive entries in a recursive function
- Recursive processing - subproblem
- VS中使用动态库
- Sequential action localization | fine grained temporal contrast learning for weak supervised temporal action localization (CVPR 2022)
- 【BM2 链表内指定区间反转】
- Servlet filter details
- The number of weeks of Oracle last year and this year, with the start time and end time
猜你喜欢

Recursive processing - subproblem

VRRP protocol and experimental configuration

Understanding the mathematical essence of machine learning

Interpretation of TPS motion (cvpr2022) video generation paper

逆序打印链表

The time complexity of two recursive entries in a recursive function

Kingbasees SQL language reference manual of Jincang database (7. Conditional expression)
![[the most complete and detailed] ten thousand words explanation: activiti workflow engine](/img/4c/2e43aef33c6ecd67d40730d78d29dc.png)
[the most complete and detailed] ten thousand words explanation: activiti workflow engine

How to divide the disks under the devices and drives in win10 new computer

Convolutional neural network (II) - deep convolutional network: case study
随机推荐
Traversal of the first, middle, and last order of a binary tree -- Essence (each node is a "root" node)
Database SQL language practice
Docking wechat payment (II) unified order API
【Day_03 0420】字符串中找出连续最长的数字串
移动web
Embedded sharing collection 14
Easycvr video square channel display and video access full screen display style problem repair
Code Runner for VS Code,下载量突破 4000 万!支持超过50种语言
递归处理——子问题
K. Link with Bracket Sequence I dp
【Day_04 0421】计算糖果
Ganglia installation and deployment process
Realize channel routing based on policy mode
How can machinery manufacturing enterprises do well in production management with the help of ERP system?
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!
Mysql45 speak in simple terms index
Intelligent fire protection application based on fire GIS system
[2023 Jerry technology approval test questions in advance] ~ questions and reference answers
Oc/swift Technology Download File (breakpoint continuation AFN download file alamofire Download File native download) (source code)
Introduction to three feasible schemes of grammatical generalization