网新恒天笔试题

hackbuteer1 hackbuteer1 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
1、下面程序的输出结果为()
class A
{
public:
A(int a)
{
printf("%d ",a);
}
};
A a(1);
int main(void)
{
printf("main ");
A c(2);
static A b(3);
return 0;
}

A、1 main 2 3 B、1 main 3 2 C、main 1 2 3 D、main 1 3 2

2、下面程序的输出结果为()
struct Test
{
unsigned short int a:5;
unsigned short int b:5;
unsigned short int c:6;
};
int main(void)
{
Test test;
test.a=16;
test.b=4;
test.c=0;
int i=*(short*)&test;
printf("%d\n",i);
return 0;
}

A、6 B、144 C、5 D、95

第一个题目感觉很简单,就是A,不知道这个题目是在考察什么。。
这个题目感觉很难,不会做,希望大家给出一个解题思路,这个题目不懂。。。。
...全文
评论 15
收藏 已收藏
分享
返回顶部
hackbuteer1
C++ 语言 65,214 成员 250,514 内容