当前位置:网站首页>Niuke brush questions part6
Niuke brush questions part6
2022-06-11 18:29:00 【HHYX.】
Niu Ke brush questions
- 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
The question asks 10 Turn into the system 8 Base number , Here the transformation mode and 10 Turn into the system 2 Base is similar to , take 10 Hexadecimal digits are divided by 8 Quotient for each bit , The final result is 144, choice C
- The output after executing the following statement is (A)
int I=1;
if(I<=0)
printf("****\n") ;
else
printf("%%%%\n");
A %%
B ****
C There is a grammatical error , Cannot execute correctly
D %%%%
What is used here is printf Format to print , for example %d Print as integer ,%f Print as floating point numbers , The format string has certain rules ,% After that, you need to keep up with specific characters to format and print , If the following is an invalid meaning , It will output directly % Later content . Two consecutive % Will print out a %, So choose A
- 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
here p stay () Neixianhe * combination , representative p It's a pointer , And then [] representative p The pointer points to a length of 16 Character array of , therefore C The options are right
- Array a The definition statement of is “float a[3][4];”, The following () Is an incorrect reference method to an array element .(D)
A a[i][j]
B *(a[i]+j)
C ((a+i)+j)
D (a+i4+j)
There are two ways to access arrays : One is to use [] How to access by subscribing , The other is send use finger The needle namely *(a+i) Access the contents of the array . Here you need to access a two-dimensional array . Dereference a two-dimensional array or use [] What you access is actually a one-dimensional array , Want to access an element in the array , It needs to be done again [] Or dereference to access , here ABC All meet the conditions ,D Not satisfied, so I choose D
- 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
In this question, we examine the use of macros . During program compilation , Macro expansion will be performed in the preprocessing stage , The macro will be directly replaced by the content it represents, that is A*A This is replaced by
x/=y+z*y+z/y+z*y+z
The result of the numerical operation carried in is :0 So choose D
- 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
This question examines the understanding of recursive functions , The return condition of recursion is when n<2 Return when , take n=5 Nested recursion begins to unfold , The final result is 29 So choose C
- 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
In question ,D Option when used free After releasing the contents of the pointer, he will only p The space pointed to is freed and the pointer is not set to null , Avoid setting the pointer to null manually , So choose D
- Array is defined as ”int a[4][5];”, quote ”*(a+1)+2″ Express ()( From 0 OK, let's start ) (B)
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
Each element in the two-dimensional array in the question is actually a one-dimensional array , therefore (a+1) Represents an array a The address of the first element in the .*(a+1) Represents the first element , It's a one-dimensional array , therefore *(a+1)+2 Express a The address of the element in the first row and the second column of the array , So choose B
- There's a structure like this :(A)
struct A{
long a1;
short a2;
int a3;
int *a4;
}
Excuse me at 64 Bit compiler sizeof(struct A) What's the calculated size ?
A 24
B 28
C 16
D 18
Calculate the size of the structure , Pay attention to it 64 Bit compiler environment , Therefore, the default alignment number is 8, The pointer size is also 8. Therefore, the calculation rules are based on the size of the structure :size = 4 + 2 + 4 + 2 + 8 + 4 = 24 So choose A
- 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
The operation of recursive program is investigated in the question , Observe that the recursive exit condition is n be equal to 1 Recursively exit when , The value returned each time is n Add n The third power of , That is to say 1 + 2^3 + 3^3 =36 So the final result is D
边栏推荐
猜你喜欢
MySQL/Redis 常见面试题汇总

Introduction to social engineering practice
![[c language] output the students with the highest scores with a structure. There can be multiple highest scores](/img/4e/836a8f717a2d9bf5f999a934ff4c91.png)
[c language] output the students with the highest scores with a structure. There can be multiple highest scores

平衡搜索二叉树——AVL树

Force deduction 23 questions, merging K ascending linked lists

vim常用命令

求字符串中最大的 3 位相同数字

SISO Decoder for SPC (补充章节1)

On the problem that the while loop condition in keil does not hold but cannot jump out

力扣刷题——二叉树的层序遍历
随机推荐
viso的常见操作
下载代码,并编译环境的问题
高性能架构设计
System learning typescript (V) - joint type
[C语言]用结构体按分数高低降序输出学生的姓名和分数
Force buckle 31 next arrangement
V-for loop traversal
使用Transformers将TF模型转化成PyTorch模型
Radio button text background changes at the same time
牛客刷题——part7
TI AM64x——最新16nm处理平台,专为工业网关、工业机器人而生
LDAP 目录服务器的现代化应用
Modern application of LDAP directory server
初识企业级平台
SISO Decoder for Repetition(补充章节4)
力扣31 下一个排列
金融银行_催收系统简介
01.电信_领域业务经验
SISO decoder for a general (n, n-1) SPC code (supplementary Chapter 3)
全志科技T3开发板(4核ARM Cortex-A7)——MQTT通信协议案例