当前位置:网站首页>[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
边栏推荐
- Detailed explanation of the whole process of coding's pressure measurement operation
- 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!
- Qu Weihai, chairman and CEO of Xinyi interactive, adheres to mutual benefit and win-win results, and Qu Weihai promotes enterprise development
- Taobao JD pinduoduo Tiktok taote 1688 and other multi platform commodity app details API interfaces (commodity details page data interface, commodity sales interface, keyword search commodity sales in
- Modifiers should be declared in the correct order
- 光量子里程碑:6分钟内解决3854个变量问题
- Matlab 向量与矩阵
- Embedded sharing collection 14
- Flex layout
- L. Link with Level Editor I dp
猜你喜欢

Interview difficulties: difficulties in implementing distributed session, this is enough!

对接微信支付(二)统一下单API

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

PHP 多任务秒级定时器的实现方法

Introduction to three feasible schemes of grammatical generalization

分布式 | 实战:将业务从 MyCAT 平滑迁移到 dble

Leetcode:934. The shortest Bridge
![[Oracle SQL] calculate year-on-year and month on month (column to row offset)](/img/ee/59d050e03c2a4ba04de57df1322283.png)
[Oracle SQL] calculate year-on-year and month on month (column to row offset)

Mysql45 speak in simple terms index

VS中使用动态库
随机推荐
招标信息获取
Meiker Studio - Huawei 14 day Hongmeng equipment development practical notes 4
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!
Registration conditions for system integration project management engineer (intermediate level of soft exam) in the second half of 2022
语法泛化三种可行方案介绍
Kingbasees SQL language reference manual of Jincang database (6. Expression)
Solutions to the failure of copy and paste shortcut keys
Optical quantum milestone: 3854 variable problems solved in 6 minutes
[day_020419] sort subsequence
How can programmers improve mental internal friction?
redis 哨兵集群搭建
【Day_05 0422】统计回文
H. Take the elevator greedy
Widget is everything, widget introduction
【Day05_0422】C语言选择题
卸载手机自带APP的操作步骤
英语句式参考纯享版 - 定语从句
【Day_07 0425】合法括号序列判断
Webapi collation
Cdga | how to build data asset catalogue?