#989. C++语法阶段测试1

C++语法阶段测试1

  1. 世界上第一个程序员是男是女? {{ select(1) }}

  1. C++ 是以下哪类语言? {{ select(2) }}
  • 机器语言
  • 汇编语言
  • 高级语言
  • 智能语言

  1. 11011211011_2 转为十进制数是?

    {{ select(3) }}

  • 26
  • 27
  • 28
  • 29

  1. 11011311011_3 转为十进制数是? {{ select(4) }}
  • 26
  • 27
  • 111
  • 112

  1. 针对以下代码,输出的结果是?

    int a = 1;
    a = a ++;
    switch(a) {
     	case 1: cout << "hello ";
     	case 2: cout << "world ";
     	case 3: cout << "c++ ";
     	default: cout << "oh yeah! ";
    }
    

    {{ select(5) }}

  • hello world c++ oh yeah!
  • world c++ oh yeah!
  • c++ oh yeah!
  • oh yeah!

  1. 231023_{10} 的三进制是? {{ select(6) }}
  • 211
  • 212
  • 213
  • 214

  1. 位运算 7|2 的结果是 ? {{ select(7) }}
  • 2
  • 0
  • 7
  • 5

  1. 针对下列代码,输出的结果是 ?
#include <iostream>
using namespace std;

bool foo(int x, int y) {
	int t = x;
	x = y;
	y = t;
}

int main () {
    
	int a = 1;
	int b = 2;
	foo(a, b);

	cout << a << " " << b << endl;

    return 0;
}

{{ select(8) }}

  • 1 1
  • 1 2
  • 2 1
  • 2 2

  1. 针对下列代码,输出的结果是 ?
#include <iostream>
using namespace std;

bool foo(int &x, int &y) {
	int t = x;
	x = y;
	y = t;
}

int main () {
    
	int a = 1;
	int b = 2;
	foo(a, b);

	cout << a << " " << b << endl;

    return 0;
}

{{ select(9) }}

  • 1 1
  • 1 2
  • 2 1
  • 2 2

  1. -1 的八位二进制补码是? {{ select(10) }}
  • 11111111
  • 11111110
  • 10000001
  • 10000000