25.完成下列程序
..
......
............
....................
..............................
..........................................
........................................................
#include
#define N 8
int main()
{
int i;
int j;
int k;
---------------------------------------------------------
| |
| |
| |
---------------------------------------------------------
return 0;
}
26 完成程序,实现对数组的降序排序
#include
void sort( );
int main()
{
int array[]={45,56,76,234,1,34,23,2,3}; //数字任//意给出
sort( );
return 0;
}
void sort( )
{
____________________________________
| |
| |
|-----------------------------------------------------|
}
27 费波那其数列,1,1,2,3,5……编写程序求第十项。可以用递归,也可以用其他方
法,但要说明你选择的理由。
#include
int Pheponatch(int);
int main()
{
printf("The 10th is %d",Pheponatch(10));
return 0;
}
int Pheponatch(int N)
{
--------------------------------
| |
| |
--------------------------------
}
28 下列程序运行时会崩溃,请找出错误并改正,并且说明原因。
#include
#include
typedef struct{
TNode left;
TNode right;
int value;
} TNode;
TNode root=NULL;
void append(int N);
int main()
{
append(63);
append(45);
append(32);
append(77);
append(96);
append(21);
append(17); // Again, 数字任意给出
}
void append(int N)
{
TNode NewNode=(TNode )malloc(sizeof(TNode));
NewNode->value=N;
if(root==NULL)
{
root=NewNode;
return;
}
else
{
TNode temp;
temp=root;
while((N>=temp.value && temp.left!=NULL) || (N
NULL
))
{
while(N>=temp.value && temp.left!=NULL)
temp=temp.left;
while(N
temp=temp.right;
}
if(N>=temp.value)
temp.left=NewNode;
else
temp.right=NewNode;
return;
}
}
29. A class B network on the internet has a subnet mask of 255.255.240.0, what
is the maximum number of hosts per subnet .
a. 240 b. 255 c. 4094 d. 6553
4
30. What is the difference: between o(log n) and o(log n^2), where both logari
thems have base 2 .
a. o(log n^2) is bigger b. o(log n) is bigger
c. no difference
31. For a class what would happen if we call a class’s constructor from with
the same class’s constructor .
a. compilation error b. linking error
c. stack overflow d. none of the above
32. “new” in c++ is a: .
a. library function like malloc in c
b. key word c. operator
d. none of the above
33. Which of the following information is not contained in an inode .
a. file owner b. file size
c. file name d. disk address
34. What’s the number of comparisons in the worst case to merge two sorted li
sts containing n elements each .
a. 2n b.2n-1 c.2n+1 d.2n-2
35. Time complexity of n algorithm T(n), where n is the input size ,is T(n)=T(
n-1)+1/n if n>1 otherwise 1 the order of this algorithm is .
a. log (n) b. n c. n^2 d. n^n
36. The number of 1’s in the binary representation of 34096+ 15256+516+3 a
re .
a. 8 b. 9 c. 10 d. 12
37.设计函数 int atoi(char s)。
38.int i=(j=4,k=8,l=16,m=32); printf(“%d”, i); 输出是多少?
39.解释局部变量、全局变量和静态变量的含义。
40.解释堆和栈的区别。
41.论述含参数的宏与函数的优缺点。
42. 以下三条输出语句分别输出什么?[C易]
char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char str5 = "abc";
const char str6 = "abc";
cout << boolalpha << ( str1==str2 ) << endl; // 输出什么?
cout << boolalpha << ( str3==str4 ) << endl; // 输出什么?
cout << boolalpha << ( str5==str6 ) << endl; // 输出什么?
答:分别输出false,false,true。str1和str2都是字符数组,每个都有其自己的存储区,它们的值则是各存储区首地址,不等;str3和str4同上,只是按const语义,它们所指向的数据区不能修改。str5和str6并非数组而是字符指针,并不分配存储区,其后的“abc”以常量形式存于静态数据区,而它们自己仅是指向该区首地址的指针,相等。
2020年河北新闻网两学一做
时间:2023-09-18 07:0:242020年河北新闻网两学一做
时间:2023-09-15 11:0:59两学一做学习教育知
时间:2023-09-21 06:0:302020年开展两学一做学习教
时间:2023-09-19 21:0:30
C++ 编程笔试题和面试题答案目2023-09-18 23:12:51
微软笔试题和面试题答案解析与答案2023-09-15 23:38:50
陕西国际商贸学院在重庆高考专业招生计划(人数+代码)2025-05-22 10:38:12
安徽建筑大学和新余学院哪个好 分数线排名对比2025-05-22 10:36:54
襄阳职业技术学院广西录取分数线及招生人数 附-2020最低位次排名2025-05-22 10:35:29
长江大学和新疆师范大学哪个好 分数线排名对比2025-05-22 10:34:16
锦州师范高等专科学校在辽宁高考专业招生计划(人数+代码)2025-05-22 10:32:49
山东高考排名在17550的考生能报什么大学(原创)2025-05-22 10:31:33
广州华立学院的英语专业分数线(附2020-最低分排名怎么样)2025-05-22 10:30:14
兰州石化职业技术大学的理化测试与质检技术专业分数线(附2020-最低分排名怎么样)2025-05-22 10:29:06
泉州师范学院和亳州学院哪个好 分数线排名对比2025-05-22 10:27:53
贵州医科大学在江西高考专业招生计划(人数+代码)2025-05-22 10:26:23
东莞城市学院和西安工商学院哪个好 分数线排名对比2025-05-22 10:24:51
山东海事职业学院的水路运输安全管理专业分数线(附2020-最低分排名怎么样)2025-05-22 10:23:44 


