当前位置:网站首页>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
边栏推荐
- SISO Decoder for min-sum(补充章节2)
- Talking about telework | community essay solicitation
- v-for循环遍历
- Learn to use LSTM and IMDB comment data for emotion analysis training
- Ubuntu installs PSQL and runs related commands
- Several commands related to domain name
- 牛客刷题——Fibonacci数列
- 力扣39题组合总和
- [c language] output students' names and scores in descending order of scores with structures
- Quanzhi technology T3 development board (4-core arm cortex-a7) - mqtt communication protocol case
猜你喜欢

New work of "the father of LSTM": a new method towards self correcting neural network

async导致函数结果出乎意料,改变原来代码的意图;await is only valid in async functions and the top level bodies of modules

Getting started with CTF

力扣刷题——二叉树的层序遍历Ⅱ

SISO decoder for a general (n, n-1) SPC code (supplementary Chapter 3)

Cryptology Summary

“LSTM之父”新作:一种新方法,迈向自我修正的神经网络

力扣刷题——二叉树的最近公共祖先

Some problems of DC-DC bootstrap capacitor

平衡搜索二叉树——AVL树
随机推荐
牛客刷题——part8
力扣23题,合并K个升序链表
Force buckle 31 next arrangement
Function and principle of key in V-for
[C语言]用结构体把平均分和低于等于平均分的学生数据输出
牛客刷题——不要二
H. 264 concept
高性能架构设计
IEDA 底层菜单菜单简介
全志科技T3开发板(4核ARM Cortex-A7)——视频开发案例
[golang] leetcode - 292 Nim games (Mathematics)
MMA-Self-defining function
最长严格递增子序列
H.264概念
Two methods for matlab to save imshow drawing pictures to a specified folder
VIM common commands
JS实现全屏展示的具体方法
牛客刷题——把字符串转换成整数
牛客刷题——二叉搜索树与双向链表
力扣39题组合总和