wujr5/c-and-cpp-language-learning

计科:week11 自编选择题

wujr5 opened this issue · 62 comments

wujr5 commented

week11 Experiment 5.5

自编选择题

由于本周没有实验任务,根据老师要求,添加小小的课后练习。很轻松,很简单,也很有趣。

要求

  1. 每个人设计三道选择题。
  2. 每一道选择题覆盖的知识点不限,但不能太简单,一看就懂的那种就十分不建议。
  3. 最好是C++语言中难以理解的知识点,或者容易忽略的重点。
  4. 除了问题以外,你还有为你的问题准备答案,以及相关解释。
  5. 周五上课随机抽取部分同学的选择题,让大家一起做,然后由作者讲解,其他同学可以质疑并提问。
  6. 请使用英文。

模板

0 简介

你的姓名学号
balabala你出题的初衷诸如此类

1 题目

1.1 题目1

balabala题目内容

1.2 题目2

balabala题目内容

1.3 题目3

balabala题目内容

2 答案及解析

2.1 题目1答案及解析

balabala题目答案及解析

2.2 题目2答案及解析

balabala题目答案及解析

2.3 题目3答案及解析

balabala题目答案及解析

提交

提交到如下文件夹。

image

命名格式

cs_cpp_学号_姓名_exp5.5.pdf

Deadline

12月3日 21:00

最后

请把你的题目部分添加到本github下面的评论区域,就像你的期中总结一样。

格式:(注意加粗和空行,为了好看些~)

学号:1555xxxx,姓名:张三

题目1:
balabala题目内容

题目2:
balabala题目内容

题目3:
balabala题目内容

wujr5 commented

Example

学号:1555xxxx,姓名:张三

题目1:

1. Is TA a homesome boy ? Please choose the right answer.
A. Yes, he is. 
B. Yes, he very is. 
C. Yes, he very very is. 
D. Yes, he very very very is.

题目2:
balabala题目内容

题目3:
balabala题目内容

学号:15336226,姓名:叶子卿

题目1:

  1. What's the output of following program:
int a;
void print(int x) {
    if (x > 5) return;
    cout << x << ' ';
    print(x ++);
}
int main() {
    a = 0;
    print(a);
    return 0;
}

A. 0 1 2 3 4 5 6
B. 0 1 2 3 4 5
C. 1 2 3 4 5
D. endless loop

题目2:
2. What's the output of following program:

int a;
void print(int x) {
    if (x > 5) return;
    cout << a << ' ';
    print(a ++);
}
int main() {
    a = 0;
    print(a);

    return 0;
}

A. 0 1 2 3 4 5 6
B. 0 1 2 3 4 5
C. 1 2 3 4 5
D. endless loop

题目3:
3. What's the output of following program:

int a;
void print(int x) {
    if (x > 5) return;
    cout << a << ' ';
    print(++ a);
}

int main() {
    a = 0;
    print(a);

    for(;;);
    return 0;
}

A. 0 1 2 3 4 5 6
B. 0 1 2 3 4 5
C. 1 2 3 4 5
D. endless loop

学号:15336237,姓名:张丰学

题目1
What is true about the following code:

int main() {
    string a,b;
    cin >> a;
    getline(cin,b);
    getline(cin,b);
    return 0;
}

A. if the input is “1 2”, a is “1”, b is “ 2”;
B. if the input is “1 2”, a is “1”, b is “2”;
C. if the input is “1” in the first line and “2” in the second line, a is “1”, b is “ 2”;
D. if the input is “1” in the first line and “2” in the second line, a is “1”, b is “2”;

题目2
What is true about the following code:

int main() {
    const double PI = 3.1415926;
    cout << fixed << setprecision(2);
    cout << PI << endl;
    cout << setw(8);
    cout << PI << endl;
    cout << PI << endl;
    return 0;
}

A. the output are “3.1415926” in three different lines;
B. the output are “3.14” in three different lines;
C. the output are “3.14” in the first line and “ 3.14” in the following two lines.
D. None of the above

题目3
What is true about the following code:

int main() {
    string a = "100";
    string b = "200";
    int c, d;
    stringstream mid;
    mid << a;
    mid >> c;
    mid << b;
    mid >> d;
    cout << a / b << endl;
    return 0;
}

A. The code can compile and run well
B. The output will be 0.5 if ” cout << a / b << endl;” is changed into “”cout << c / d << endl;”
C. The output will be 0.5 if ” cout << a / b << endl;” is changed into “”cout << (double)c / d << endl;”
D. None of the above

SgLy commented
学号:15336251,姓名:郑树诚

Problem 1: What will happen to the following code?
#include <iostream>
using namespace std;

int main() {
    {
        int a;
        a = 5;
    }
    cout << a << endl;
    return 0;
}
A. Encounter a compilation Error;
B. Output: 5;
C. Encounter a run-time Error;
D. Output: 0.

Problem 2: What will happen to the following code?
#include <iostream>
using namespace std;

int main() {
    int b = 0;
    b = b++;
    cout << b << endl;
    return 0;
}
A. Encounter a compilation Error;
B. Output: 1;
C. Encounter a run-time Error;
D. Output: 0.

Problem 3: What will happen to the following code?
#include <iostream>
#include <climits>
using namespace std;

int main() {
    int a;
    a = INT_MAX + 1;
    cout << a << endl;
    return 0;
}
A. Output: 2147483648;
B. Output: -2147483648;
C. Encounter a run-time Error;
D. Output: -1.

Hint: pow(2, 31) == 2147483648
      INT_MAX == 2147483647

学号:15336242,姓名:张舰廷

题目1
What is true about the following code:

int main() {
int a = 3;
cout << a && true;
cout << " ";
cout << (a && true) << endl;
return 0;
}
A、1 1;
B、3 1;
C、1 0;
D、compile error

题目2
What is true about the following code:

int qqb(int a = 1, int b = 2, int c) {
return a + b + c;
}
int main() {
int x;
x = qqb(10, 5);
cout << x << endl;
return 0;
}

A、15;
B、16;
C、17;
D、compile error

题目3
What is true about the following code:

int main() {
int x = 0, y1, y2, y3, y4;
y1 = (x++, x) ? 1 : 0;
x = 0;
y2 = (++x, x) ? 1 : 0;
x = 0;
y3 = (x, ++x) ? 1 : 0;
x = 0;
y4 = (x, x++) ? 1 : 0;
cout << y1 << " " << y2 << " " << y3 << " " << y4 << endl;
return 0;
}
A、1 1 1 1;
B、0 1 1 1;
C、1 1 1 0;
D、0 1 1 0;

学号:15336267 姓名:朱志强
题目1:what’s the output of the following program?
#include
using namespace std;
int main() {
int a = 0;
int b = a ++;
int c = ++ a;
cout << b <<" "<< c;
}
A.1 1
B.0 1
C.1 0
D.0 2
题目2:what’s the output of the following program?
#include
using namespace std;
int s (int& b) {
b ++;
return b;
}
int main() {
int b = 1;
cout << s (b);
cout << " " << b;
}
A.1 1
B.1 2
C.2 2
D.None of above
题目3:what’s the output of the following program?
#include
using namespace std;
int main () {
bool s = -1;
if (s == 1) {
cout << "Hello World!";
}
else cout << "Error";
}
A.Hello World!
B.Error
C.Compile error
D.Noting

学号:15336228 姓名:于博洋

题目1

1.What is the output of the following program
#include
using namespace std;
int main(){
int i=1;
cout << i++ + i++ << endl;
}

a.3
b.4
c.5
d.6

题目2
2.What is the output of the following program
#include
using namespace std;
int main(){
int i=1;
cout << ++i + ++i << endl;
}
a.3
b.4
c.5
d.6

题目3
3.What is the output of the following program
#include
using namespace std;
int main(){
int i=1;
cout << ++i + ++i + ++i<< endl;
}
a.6
b.8
c.10
d.12

学号:15336257, 姓名:钟晓庆


题目1:

  1. What's the output of following program:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main() {
    string s1 = "5  complete";
    istringstream s2(s1);
    int m;
    s2 >> m;
    cout << m << endl;
return 0;
}
A. Encounter a compilation Error.
B. Output: 5.
C. Encounter a run-time Error.
D. Output: 5 complete.

题目2:
2. How many times is letter ‘a’ be printed? :

#include <iostream>
using namespace std;

int main()  {
    int i = 0;
    for( i; i < 10; i++) {
        }
    cout << “a” << endl;
A: 10.
B: Compiler Error.
C:Runtime Error.
D:1.

题目3:
3. What’s the output of the following code? :

#include <iostream>
using namespace std;

int main() {
int n = 1;
while(n--) {
        cout << n << “ ”;
}
return 0;
}
A: 1 0.
B: 0.
C: Nothing
D: Compiler Error.
AK323 commented

学号:15337020, 姓名:施志雄

题目1
What is the value in count after the following loop is executed?
int count = 0;
do
{
cout << "Welcome to C++";
} while (count++ < 9);
cout << count;
A. 8
B. 9
C. 10
D. 11
题目2
int number = 25;
int i;
bool isPrime = true;
for (i = 2; i < number && isPrime; i++) 
{
   if (number % i == 0)
   {
     isPrime = false;
   }
}
cout << "i is " << i << " isPrime is " << isPrime << endl;
A.i is 5 isPrime is 1
B. i is 5 isPrime is 0
C. i is 6 isPrime is 1
D. i is 6 isPrime is 0
题目3
What is the output of the following program?

#include < iostream >
using namespace std;
int main()
{
   int a = 5;
   float b;
   cout << sizeof(++a + b);
   cout << a;
   return 0;
}
A. 2 6
B. 4 6
C. 2 5
D. 4 5

姓名:马玉玺 学号:15337016
1题目
1.1题目
What is the output of the following code?
double a[3] ={1.1,2.2,3.3};
cout<<a[0]<<” “<<a[1]<<” “<<a[2]<<endl;
a[1] =a[2];
cout<<a[0] <<” “<<a[1] <<” “<<a[2] <<endl;

1.2题目
What is the output of the following code?
Int i, temp[10];
For (i=0;i<10;i++)
Temp[i]=2*i;
For (i=0;i<10;i++)
cout<<temp[i]<<” “;
Cout<<endl;
For (i=0;i<10;i=i+2)
Cout<<temp[i]<<”";
1.3题目
What is the output of the following code?
int count=3;
while (count-->0)
cout<<count<<" ";

学号:15337017 姓名:牟者斌

problem1

What is the output of the following program?

#include <iostream>
 using namespace std;
 void addprint()
 {
   static int s = 1;
   s++;
   cout << s;
}
int main()
{
   addprint();
   addprint();
   addprint();
   return 0;
}

A. 234
B. 111
C. 235
D. 123

problem2

What is the output of the following program?

#include <iostream>
using namespace std;
int main() {
  int a = 5;
  double b;
  cout << sizeof(++a + b);
  cout << a;
  return 0;
}

A. 2 6
B. 4 6
C. 2 5
D. 4 5
E. None of mentioned

problem3

What is y after the following statement is executed?

int x = 3; int y = 4;
if (( x ) || ( x > 3))
 switch (x + 3) {
  case 6: y = 0;
  case 7: y = 1;
  default: y += 1;
}
y = y++ + ++y;

A. 2
B. 4
C. 6
D. 8

0 简介

姓名:郑兴达
学号: 15336253

1 题目

1.1 题目 1

Which command can compile test.cpp and get a test.exe debuggable with GDB?
A. g++ -DDEBUG test.cpp -o test.exe
B. g++ test.cpp -g -o test.exe
C. gcc test.cpp -g -o test.exe
D. gdb test.cpp -o test.exe

1.2 题目 2

If I want to break before outputing variable out in the program shown below, what GDB command
should I use?

01:#include <iostream>
02:using namespace std;
03:
04:int main()
05:{
06:int out = 10;
07:out *= 20;
08:cout << out << endl;
09:return 0;
10:}

A.bt 8
B.b 8
C.cont
D.set args 8

1.3 题目 3

The source code of test.cpp (compiled into test.exe) is shown below:

#include <iostream>
using namespace std;
int main()
{
cout << "a" << endl;
cerr << "b" << endl;
}
return 0;

If I run D:\CS-Basic> test.exe > a.txt, What will occur?
A. Nothing printed, but the content of a.txt is “ab” (without “”).
B. “a” is printed, the content of a.txt is “b” (without “”).
C. “b” is printed, the content of a.txt is “a” (without “”).
D. “ab” is printed, nothing's in a.txt.

学号:15336238 , 姓名:张皓宇
题目1:
Problem 1 How many times will 'Hello' and 'World' be printed respectively?
#include
using namespace std;
void print (string, int);
double count (int a, int b = 3, int c = 6) {
double count = a + b + c;
return count;
}
void swap (int a, int b) {
int temp = a;
a = b;
b = temp;
}
int main() {
int a = 4;
int b = 7;
print ("Hello", 2);
swap (a, b);
print ("World", a);
return 0;
}
int a;
void print (string ch, int n) {
if (n == 4)
return;
n = count(a, 0);
n++;
for (int i = 0; i < n; i++)
cout << ch << endl;
}
A.7,12.
B.7,5.
C.7,0.
D.7,7.

题目2:
Problem2 Which is the correct output?
#include
using namespace std;
double a (int a,int b = 1,int c = 2) {
double q = a + b + c;
cout << q << " ";
}

int main() {
cout << a(4, 2) << " ";
cout << a (4, 3, '2') << " ";
}
A.8 8 9 9.
B.8 0 9 0.
C.8 0 57 0.
D.compile error.

题目3:
Problem3 To satisfy output Champion1234,what is the value of x and y,and the value of strlen(a) at last?
#include
#include
using namespace std;
int main() {
char a[] = "Champion12 34";
memmove (a+x, a+y, strlen(a));
cout << a << " ";
cout << strlen(a);
return 0;
}
A.11 12 12.
B.12 11 13.
C 10 11 12.
D.11 10 13.

学号:15338259 姓名:周俊澎
题目1:what is i after the following for loop?
int y = 0;
for (int i = 0; i < 10; ++i) {
y += i;}
A. 9
B. 10
C.11
D.undefined
题目2:pow(4.0, 1/2)returns
A. 0
B. 1
C. 2
D. 3
题目3:What is the output of the following code:

int list[] = {1, 2, 3, 4, 5, 6};

for (int i = 1; i < 6; i++)
  list[i] = list[i - 1];

for (int i = 0; i < 6; i++)
  cout << list[i] << " ";

A. 1 2 3 4 5 6
B. 2 3 4 5 6 6
C. 2 3 4 5 6 1
D. 1 1 1 1 1 1

answer:DBD

学号:15336249 姓名:郑博文
题目1 What’s the output of the following code?
#include
using namespace std;

int main() {
int a = 1;
a = a++ + ++a;
cout << a ;
a = ++a + a++;
cout << a << endl;
return 0;
}
A.4 5 B.5 5 C.4 10 D.4 11
题目2 What’s the output of the following code?
#include
using namespace std;

int main(){
int a = 1;
if(a--){
cout << "true " ;
}
else
cout << "false ";
if(a = 0){
cout << "true" << endl;
}
else
cout << "false" << endl;
return 0;
}
A.true true B.true false C.false true D.false false
题目3What’s the output of the following code?
#include
#include
using namespace std;

int main(){
cout << (double)pow(4,(double)(1/2)) <<endl;
return 0;
}
A.2 B.2.0 C.1 D.1.0

学号:15336247 姓名:赵维俊
题目1
What is the output of the following code? ( )
#include
using namespace std;
int main() {
int a[10] = {1, 2, 3, 4, 5, 6, 7, 8}, i;
for (i = 0; i < 10; i ++) {
cout << a[i] << " ";
}
return 0;
}
A.The program has a compile error.
B.1 2 3 4 5 6 7 8.
C.None of the above
D.1 2 3 4 5 6 7 8 9 10
题目2
What is the output of the following code? ( )
#include
using namespace std;
void f(int n) {
n ++;
cout << "x is " << n << endl;
}
int main() {
int x = 1;
cout << "x is " << x << endl;
f(x);
if (x == 2) {
cout << "x is " << x << endl;
}
return 0;
}
A. X is 1
X is 2
B. X is 1
X is 2
X is 1
C. X is 1
X is 2
X is 2
D. X is 1
X is 1
题目3
Analyze the following code: ( )
#include
using namespace std;
int main() {
int a[3][3] =
{{1, 2, 3},
{4, 5, 6},
{7, 8, 9}};
for (int i = 0; i < 3; i++) {
cout << a[i][1] << " ";
}
return 0;
}
A. The program has a compile error.
B. The program runs fine and displays 2 5 8.
C. The program runs fine and displays 1 4 7.
D. The program runs fine and displays 1 2 3.

学号:15336232,姓名:余木建
题目1
1.What is the output of the following program?

 Int main() {
    int x = 1;
    int a = x++ + 5;
    int b = ++x + 5;
    cout << x << a << b;
}

A.168
B.367
C.368
D.357

题目2
2.What is the output of the following program?

int main() {
    cout << setw(6) << "abc" << "def" << endl;
    cout << setw(6) << "abc" << setw(6) << "def";
}

A.(3 space) + abcdef; (3 space) + abc + (3 space) + def
B. (3 space) + abc + (3 space) + def; (3 space) + abc + (3 space) + def
C.(3 space) + abcdef;(3 space) + abcdef
D. None of the above

题目3
3.What is the output of the following program?

Int main() {
  int s;
  for(int i = 0; i++; i < 10) {
    s += 1;
  }
  cout << s;
}

A.9
B.10
C.0
D.None of the above

学号:15336244,姓名:赵成
题目 1:
What is the value of the following expression using “ cout ” to output :
(1) 0/0 (2) 0/0.0 (3) 1.0/0.0
A. (1) Compile error (2) Compile error (3) Compile error
B. (1) Running error (2) inf (3) Compile error
C. (1) Running error (2)nan (3)inf
D. (1) Compile error (2)nan (3) Running error
题目 2:
What is the running result of the following code?
#include
using namespace std;
int main( ) {
double i;
for(i = 0; i != 10; i += 0.1)
cout << i << endl;
return 0;
}
A.0
0.1
……
9.9
B.0
0.1
……
10
C . The program will not stop
题目 3:

X = 11 , then the expression (x++*1/3)’s value is ( )
A. 3
B. 4
C. 11
D. 12

学号:15336239 姓名:张弘

题目一

Which of the following might cause an error?
A.  char text[]=”Good”;
B.  char text[]={‘G’,’o’,’o’,’d’};
C.  char text[5]= {‘G’,’o’,’o’,’d’};
D.  char text[]={‘G’,’o’,’o’,’d’,0};

题目二

What is the return value for f(4) after calling the following function?

int f(int n){
    if(n==1)
    return 1;
    else 
    return n+f(n-1);
}

A.9
B.10
C.11
D.12

题目三

Analyze the following program fragment:

double sum=0;
double d=0;
while (d!=10.0){
    d+=0.1;
    sum+=d; 
}

A. The program does not compile because sum and d are declared double, but assigned with integer 0
B. The program never stops because d is always 0.1 inside the loop.
C. The program may not stop because of the phenomenon referred to as numerical inaccuracy for operating with floating-point numbers.
D. After the loop, sum is 0+0.1+0.2+0.3+…..+1.9

学号:15336268,姓名:庄书琪
题目1:Suppose a = 5, b = 4 and c = 7, d = 3, what will the following program output?
#include<iostream>

using namespace std;

int main() {
  if( a >= 5 && b < 5 || d < 5 && c >= 5) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

A.YES
B.NO
C.YESNO
D.None

题目2:Suppose a = 1, what will the following program output?
#include<iostream>

using namespace std;

int main() {
  int a = 1;
  int b;
  b = a++ + ++ a;
  b / = a;
  cout << b << endl;
  return 0;
}

A.1
B.1.333333
C.2
D.0

题目3:Suppose a = -25, b = 4, what will the following program output?
#include<iostream>

using namespace std;

int main() {
  int a = -25, b = 4;
  cout << a % b << endl;
  return 0;
}

A.1
B.-1
C.0
D.none

学号:15336227 姓名:雍灵聪

题目一
下面的代码会输出什么:
A.YES B. 2 C. YES 2 D.3
#include
using namespace std;
int main() {
int x = 1 ;
int y = 2 ;
if ( x >2 && ++y) {
cout << "yes" << endl;
}
cout << y << endl;
return 0 ;
}

题目二
下面的代码会输出什么:
A.1 2 B.2 3 C.2 1 D.2 2
#include
using namespace std;
int main() {
bool a = 1 ;
cout << a + 1 << endl;
a = a + 1 ;
cout << a << endl;
return 0 ;
}

题目三
下面的代码会输出什么:
A.1 B.0
#include
using namespace std;
int main() {
unsigned a = -1;
int b = 2;
bool k = 0;
if (a > b)
k = 1;
cout << k << endl;
return 0;
}
答案:B C A

学号:15336224 姓名:叶家梁
题目1
1.what’s the output of following program:
#include
using namespace std;
int main() {
int i = 0;
int ans = 1;
while (i++) {
if (i++ > 5) {
break;
}
ans = ans + i;
}
cout << ans << endl;
return 0;
}
A.10
B.15
C.21
D.1
题目2
2.what’s the output of following program:
#include
using namespace std;
int main() {
int a = 1;
int b = (a++,++a);
cout << a << " " << b << endl;
return 0;
}
A.3 2
B.3 3
C.2 2
D.2 3
题目3
3.what’s the output of following program:
#include
using namespace std;
int main() {
int i = 1;
for (;i++ < 5;) {
cout << i << " ";
}
return 0;
}
A.1 2 3 4 5
B.1 2 3 4
C.2 3 4
D.2 3 4 5

学号:15336264 姓名:朱昆仑
题目一:
What is the output of this program?(based on dev c++ 5.10)
int main() {
int a,b;
double c,d;
a=1.999999999999999;
cout<<a<<" ";
b=1.9999999999999999;
cout<<b<<" ";
c=1.99999;
cout<<c<<" ";
d=1.999999;
cout<<d<<" ";
cout<<setprecision(6)<<d<<" ";
cout<<setprecision(7)<<d<<" ";
cout<<fixed<<setprecision(2)<<d<<endl;
return 0;
}
A.1 1 1.99999 1.999999 1.9999 1.999999 1.99
B.1 2 1.99999 2 2 1.999999 2.00
C.1 1 2 2 1.99999 2 2.00
D.1 2 1.99999 1.999999 2 2 1.99
题目二:
What is the output of this program?(based on dev c++ 5.10)
#include
#include
using namespace std;

int main() {
if(1 - 0.1 == 0.9)
cout<<"1"<<" ";
if(1 - 0.1 -0.1 != 0.8)
cout<<"false"<<" ";
if(1 - 0.1 - 0.1 - 0.1 != 0.7)
cout<<false<<" ";
if(1 - 0.1 - 0.1 -0.1 - 0.1 -0.1 == 0.5)
cout<<true<<" ";
if(abs(1 - 0.1 - 0.1 - 0.1 - 0.1 - 0.1 - 0.5 )<1E-14)
cout<<"true"<<endl;
return 0;
}
A.1 false false true true
B.1 false 0 1 true
C.1 true
D.1 0 true
E.1 false 0 true
题目三:
What is the output of this program?
int main() {
char a = 'a';
char b = b;
switch( a ){
case 97:cout<<a<<" ";
case 98:cout<<"b"<<" ";
default:a=b;
}
cout<<a<<endl;
return 0;
}
A.nothing
B.a
C.a b
D.a b b
E.97
F. Compile error

学号:15336243,姓名:张鹏泽
题目1:Suppose n = 8, what will the following program output?

#include<iostream> 
using namespace std;
int main(){
    int n = 8, i;
    for (i = 0; i <= n;i++ + ++i){
        cout << i << endl;
    }
    return 0;
}

A. 0 2 6
B. 0 2 6 8
C. 0 2 4 6 8
D. compile error
题目2:Suppose x = 2, y = 5 what will the following program output?

#include<iostream>
using namespace std;
int main(){
int x = 2, y=5;
switch(x+=2){
     case 2: y =0; break;
     case 4: y = 1; break;
     default: y+=1;
}
cout<<y<<endl;
return 0;
}

A. 0
B. 1
C. 5
D. 6
题目3:Suppose x = 0, y = -3, z = 3 what will the following program output?

#include<iostream>
using namespace std;
int main(){
    int x = 0, y = -3, z = 3;
    if (x > 0||x==0)
    if (y > 0)
    cout<<"x > 0 and y > 0";
    else if (z < 0)
    cout<<"x < 0 and z < 0";
    else if (z > 0)
    cout<<"x > 0 and z > 0";
return 0;
}

A. x > 0 and y > 0
B. x < 0 and z < 0
C. x > 0 and z > 0
D. no output

学号:15336264 姓名:朱昆仑
int main() {
int a,b;
double c,d;
a=1.999999999999999;
cout<<a<<" ";
b=1.9999999999999999;
cout<<b<<" ";
c=1.99999;
cout<<c<<" ";
d=1.999999;
cout<<d<<" ";
cout<<setprecision(6)<<d<<" ";
cout<<setprecision(7)<<d<<" ";
cout<<fixed<<setprecision(2)<<d<<endl;

return 0;

}
A.1 1 1.99999 1.999999 1.9999 1.999999 1.99
B.1 2 1.99999 2 2 1.999999 2.00
C.1 1 2 2 1.99999 2 2.00
D.1 2 1.99999 1.999999 2 2 1.99
题目二:
What is the output of this program?(based on dev c++ 5.10)
#include
#include
using namespace std;

int main() {
if(1 - 0.1 == 0.9)
cout<<"1"<<" ";
if(1 - 0.1 -0.1 != 0.8)
cout<<"false"<<" ";
if(1 - 0.1 - 0.1 - 0.1 != 0.7)
cout<<false<<" ";
if(1 - 0.1 - 0.1 -0.1 - 0.1 -0.1 == 0.5)
cout<<true<<" ";
if(abs(1 - 0.1 - 0.1 - 0.1 - 0.1 - 0.1 - 0.5 )<1E-14)
cout<<"true"<<endl;
return 0;
}
A.1 false false true true
B.1 false 0 1 true
C.1 true
D.1 0 true
E.1 false 0 true
题目三:
What is the output of this program?
int main() {
char a = 'a';
char b = b;
switch( a ){
case 97:cout<<a<<" ";
case 98:cout<<"b"<<" ";
default:a=b;
}
cout<<a<<endl;
return 0;
}
A.nothing
B.a
C.a b
D.a b b
E.97
F. Compile error

学号:15337012 姓名:李世帮

题目1
How many times will the following code print "Welcome to C++"?

int count = 0;
while (count++ < 10)
{
cout << "Welcome to C++";
}
A.8
B.9
C.10
D.11
E.0

题目2
What is the output of the following code?

int count = 0;
do
{
cout << count << " ";
}
while (count < 5);
A.1 2 3 4 5
B. 2 3 4 5
C. 0 1 2 3 4 5
D. 0 1 2 3 4
E. The program has an infinite loop

题目3
How many times will the following code print "Welcome to C++"?

int count = 0;
do
{
cout << "Welcome to C++";
} while (++count < 10);
A.8
B.9
C.10
D.11
E.0

学号:15336259, 姓名:周思聪

题目一:

1、    Which of the following statement is valid?
        const int i = 12;
A.  int *ptr1 = i;
B.  int const *ptr2 = &i;
C.  const int *ptr3 = &i;
D.  const int const *ptr4 = &i;

题目二:

2、    Which of the following statement is valid?
int i = 12;
A.  int *ptr1 = i;
B.  int const *ptr2 = &i;
C.  const int *ptr3 = &i;
D.  const int const *ptr4 = &i;

题目三:

3、    Which of the following statement is valid?
int num[] = { 1, 2, 3 };
A.  int *ptr1 = &num;
B.  int *ptr2 = num;
C.  int *ptr3 = num[0];
D.  int *ptr4 = &num[0];
E.  int *ptr5 = &num[3];

学号:15336246 姓名:赵敏达
题目1
What's the output of the following code?

#include
using namespace std;

int main() {
int a = 8;
cout << "The answer is " << a && true;
return 0;
}

A. 1
B. 8
C. 1/8
D. compile error

题目2
What's the output of the following code?

#include
using namespace std;

int main() {
int i = 2;
i = i++ + ++i + i++;
cout << i;
return 0;
}

A. 9
B. 10
C. 11
D. compile error

题目3
What's the output of the following code?

#include
using namespace std;

int main() {
int a = 2;
int b = 3;
double c = 3.0;
cout << b / a << endl << c / a << endl;
return 0;
}

A. 1.5 1.5
B. 1.0 1.5
C. 1 1.5
D. 1 1

学号:15336258,姓名:钟志杰

题目一:

How many times will the following code print "ahaha" ?

#include <iostream>
using namespace std;
int main ()
{
    for (int i = 0; i < 5; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            cout << "ahaha" << endl;
            if (j == 1) {
                break;
                break;
            }
        }
    }
}
A: 2 times;
B: 10 times;
C: 15 times;
D: Invalid;

题目二:

What`s the output of the following code?

#include <iostream>
using namespace std;
int ahaha(int i) {
    cout << "ahaha" << endl;
    return i;
}
int main() {
    cout << "hhh" << ahaha(1);
}
A: hhhahaha
    1;
B: hhh1ahaha;
C: ahaha
     hhh1;
D: ahaha
     1hhh;

题目三:

What`s the output of the following code?

#include <iostream>
using namespace std;

int main() {
    double i = 1;
    double sum = 0;
    while (i != 0) {
        sum += i;
    }
    cout << sum << endl;
    return 0;
}
A: 5.5;
B: 5.4;
C: Run Time Error;
D: Compile Error;

学号:15336256,姓名:钟钧豪

题目1:

1. How to print " "\t" is a tab character. " ?
A. cout << ""\\t" is a tab character.";
B. cout << "\"\\t\" is a tab character.";
C. cout << "\t is a tab character.";
D. cout << "\"\t\" is a tab character.";

题目2:

2. What is the output of the following program?
#include <iostream>
using namespace std;

int main() {
    int a = 3, b = 2, c = 5;
    a = b + c %= a % b;
    cout << a << " " << b << " " << c;
    return 0;
}
A. 2 2 0
B. 2 2 2
C. 3 2 5
D. Compile error

题目3:

3. What is the output of the following program?
#include <iostream>
using namespace std;

int main() {
    int i = 0;
    for (i++, i++; i++ < 20; i++ + i++); {
        cout << i++ << " ";
    }
    return 0;
}
A. 2 6 10 14 18
B. 3 7 11 15 19
C. 21
D. Compile error

学号:15336269 姓名:邹琳
题目1
What is the value of the following expression?
true || true && false
a.true
b.false
题目2
What is y after the following switch statement is executed?
int x = 3; int y = 4;
switch (x + 3) {
case 6: y = 0;
case 7: y = 1;
default: y += 1;
}
a.0
b.1
c.2
d.4
题目3
Is there anything wrong with the following program?
int radius = 2;
if(radius > 0);
{
area = radius * radius * 3.14;
cout << “ the area is “ << area;
}
a.it has a compile error
b.it has a runtime error
c.it has a logic error
d.nothing is wrong

学号:15336245 姓名:赵赣龙
题目一:
1What is the output of the following program?
#include
using namespace std;
int main() {
int a = 3, b = 4, c = 5;
cout << ((a + b)>c&&b == c) << endl;
return 0;
}
A 1;
B 0;

题目二
2what is the output of the following program?
#include
using namespace std;
int main() {
int a[9] = { 2,4,6,8,10,12,14,16,18 };
for (int i = 0; i < 9; ++i) {
cout << *(a + i) << " ";
}
}
A.2,4,6,8,10,12,14,16,18;
B.18,16,14,12,10,8,6,4,2;

题目三:
3what is the output of the following program?
#include
using namespace std;
int main() {
int a = 1, b = 0;
if (a, b)
cout << 1 << endl;
}
A.1;
B.nothing;

学号:15336231 名字:余江裕
题目一:
what is the output of program? (suppose: sizeof (short)==2)
#include
using namespace std;
int main() {
unsigned short a = 1;
short count = 0;
while (a ++ ) count ++;
cout << count << endl;
}
A.-1
B. 0
C. It’s an endless loop so there is no output.
D. 2^32 -1

题目二:
what is the output of program?
#include
using namespace std;
long write(int x) {
cout << "write函数中" << endl;
return x-1;
}
int main () {
int temp = 1;
if (write(temp))
cout << temp << endl;
}
A.no output
B.在write函数中
1
C.1
D.在write函数中

题目三:
which is the really output in the next four choices?
#include
using namespace std;
int b=1;
void masayume(int& a) {
a = (b = a + b, a + b);
return;
}
int main() {
int a = 1,b = 0;
if (sizeof(iostream)) {
masayume(a);
cout << a << “ “ << b << endl;
}
else cout<<"_^o^_//"<<endl;
}
A.compile error
B.3 0
C.2 2
D.^o^//

学号:15336241 姓名:张剑雄

题目1
What does the following code print?
int i = 2;
int j = 1;
int k = 3;
cout << (i > j ? i > k ? i : k : j > k ? j : k) << endl;
a. 1
b. 2
c. 3
题目2
What will the following code print?
int i = 3;
int j = 5;
int k = 4;
if ( i < j < k ) {
cout << “a” << endl;
}
a. a
b. error
c.no print.
题目3
string a[5];
for (int i = 0; i < 2; i++) {
a[i] = ‘s’;
}
a[3] = ‘d’;
for (int i = 0; i < 5; i++) {
cout << a[i] ;
}
cout << “q”;
a.aadq
b.aa dq
c.aa d q

yuxd5 commented

学号:15336234 姓名:余旭达
题目一:What's the output of following program:

int main(){
    int n = 8, i;
    for (i = 0; i <= n; i = i++ + ++i){
        cout << i << endl;
    }
    return 0;
}
A.  0  2  4  6  8
B.  0  4  8
C.  0  2  6
D.  compile error

题目二:What's the output of following program:

int main()
{
    double a = 3.1415926;
    int b = a;
    cout << setprecision(6) << setw(8);
    cout << a << endl << b<< endl;
    return 0; 
}
A.  (two space)3.14159
3
B.  (two space)3.14159
(seven space)3
C.  (two space)3.14159
(two space)3.14159
D.  3.1415926
3

题目三:What's the output of following program:

int main() {
    string a = "10*10";
    int b;
    stringstream mid;
    mid << a;
    mid >> b;
    cout << b << endl;
    return 0;
}
A.  10*10;
B.  100;
C.  10;
D.  compile error;

学号:15337024,姓名:韦汕
一些容易混淆,分不清,回答含糊不清的问题,希望引起注意。
题目一
What is the output of the below code?
int main ()
{
int a = 0, b = 0, c = 0;
cout << a++ <<" "<< ++a << endl;
cout << ++b <<" "<< b++ << endl;
cout << c-- <<" "<< -c-- << endl;
return 0;
}
A) .1 2 B).1 1 C).1 2 D). 1 1
2 0 1 1 2 1 1 0
-1 0 1 0 1 0 -1 0

题目二
. What is the output of the following code?
int main ()
{
int a = 1;
if (a = 2)
cout << "1" << endl;
else
cout << "2" << endl;
}
int main ()
{
int b = 1;
if (b == 2)
cout << "1" << endl;
else
cout << "2" << endl;
}
A).1 1 B).1 2 C).2 1 D).2 2
题目三
Arguments to functions always appear within __________.
A). brackets
B). parentheses
C). curly braces
D). quotation marks

学号:15337021 姓名:苏毅

题目一:Is the following code correct ?

int size = 4;
double array[size];

A. Correct
B. Wrong
C. Sometimes correct, sometimes correct
D. I don’t know

题目二:Is the following code correct ?

const int size = 4;
double array[size] = (1, 2, 3, 4);

A. Correct
B. Wrong
C. Sometimes correct, sometimes correct
D. I don’t know

题目三:What's the output of following program?

#include <iostream>
using namespace std;

void m(int, int []);

int main() {
  int x = 1;
  int y[10];
  y[0] = 1;

  m(x, y);

  cout << "x is " << x << endl;
  cout << "y[0] is " << y[0] << endl;

  return 0;
}

void m(int number, int numbers[]){
  number = 1001;
  numbers[0] = 5555;
}

A. x is 1
y[0] is 5555
B. x is 1001
y[0] is 5555
C. x is 1
y[0] is 0
D. x is 1001
y[0] is 0

学号15336229, 姓名 于达
1:
题目一:
What is the output of the following code?
void plus(int x) {
x++;
}
int main() {
int x=1;
plus(1);
cout<<x<<endl;
}
A 1
B 2
C 3
D 4
题目二:
Is there anything wrong with the following program?
int main() {
int a;
a=2^3.14;
cout<<a<<endl;
}

题目三:
What is the output of the following code?
int main() {
char a=88;
cout<<a<<end;
}会显示什么?
A 'X'
B 1234567
C 7654321
D 1593577

学号:15336236 姓名:张春柳
题目1
What is the output ?
#include
using namespace std;

int sum(int h,int k) {
int sum = h + k;
return sum;
}
double sum(int h,int k) {
double sum = h + k;
return sum;
}
int main() {
cout << sum(1, 2);
return 0;
}
a.3 b.3.0 c.compile error

题目2:
What is the output ?
#include
using namespace std;
int y = 1;
int t() {
int y = 2;
return y;
}
int main() {
cout << t() << " " << y;
return 0;
}
a.2 2 b.1 1 c.2 1

题目3:
what is kind of the error is?
#include
using namespace std;
void output(int i) {
int i = 5;
cout << "i is " << i;
}
int main() {
int i = 3;
output(i);
return 0;
}
a.logic error b.compile error c.syntax error

学号:15336240 姓名:张慧龙
题目一:What's the output of the two programs in DEV C++:
#include
using namespace std;
//(A)
int main() {
int i = 1;
cout << i ;
return ;
}
// (B)
void main() {
int i = 1;
cout << i ;
return ;
}
A. 1 , 1 ;
B. compile error , 1 ;
C. 1 , compile error ;
D. compile error , compile error ;
题目二:What's the output of the following program:
#include
using namespace std;
int main() {
char a = 'a';
char b = 'b';
cout << (char)( b - a) * ( b - a) << endl;
}
A. 1 ;
B. compile error ;
C. a ;
D. b ;
题目三:What's the output of the following program:
#include
using namespace std;
int main() {
int i = 1;
i+= i ++ ;
cout << i;
return 0;
}
A. 1 ;
B. 2 ;
C. 3 ;
D. compile error;

0、 简介
姓名:周中柱
学号:15336262
出题初衷:因为错过
1、 题目
(1) Which of following choices is true?
A、 For (int i = 1;i<=1)
B、 For (int j;j<=k;)
C、 For (j<=k;j++)
D、 For(; ;);
(2) what is the output of following program
#include
#include
Int main()
{
Cout<<fixed<<setprecision(2);
Double a = 0.5;
Cout<<a;
}
A. compile error
B. 0.50
C. 0.5
D. No output
(3) what is the purpose of using “time(0)” in srand
A、 just get the time
B、 just get a seed
C、 get a different number and seed to avoid the same seed
D、 to get a greatful number and let program more precise and randomize

学号:15336235 姓名:袁晨慧
题目1
image

题目2
image

题目3
image

学号15337007 姓名 郭宇钊

1.Suppose char x = ‘9’, what is the printout of cout << x+1<<endl ?
A) 0 B) 58 C) 10 D) :
注:“9”的ASCII代码是57 . “:”的ASCII代码是58
2.what is the printout?
Int i=3;
cout<< i++ <<” “<< i++;
A.3 4 B.3 3 C.4 4 D.4 3
3.What is the value of "(double)1/3*3 = = 1"?
A. true B. false C. 1 D. maybe true, maybe false

姓名:赵文
学号:15336248
题目一:
1.What's the output of following program:
#include
using namespace std;
int f(int n, int m) {
int temp;
temp = n;
n = m;
m = temp;
return m;
}
int main() {
int m = 2, n = 3;
cout << f(m, n) << " " << m << " " << n << endl;
return 0;
}
A.3 3 2
B.3 2 3
C.2 2 3
D. 2 3 2
题目二:
2.What's the output of following program:
#include
using namespace std;
int main() {
int a = 1, b = 2, x = 0, t;
t = (x > 0 )?a : b;
cout << t << endl;;
return 0;
}
A. 1
B. 2
C. 0;
D. Compile error
题目三:
3.What's the output of following program:
#include
using namespace std;
int main() {
for (int i = 2; i < 100; i = i * i) {
cout << i++ << " " << ++i << " ";
}
return 0;
}
A. 3 4 17 18
B. 4 4 18 18
C. 3 4 5 6 17 18
D.4 4 6 6 18 18

学号 14366108 姓名 詹博羽

1 题目
1.1
How many times will the following code print "Hello world!"?

int count = 1;
do
{
cout << "Hello world!";
} while (count++ < 10);
A. 8
B. 9
C. 10
D. 11

1.2
What is the output of the following code?

int a = 1, b, c, d;
b = a++;
c = ++a;
d = a++ + ++a;
cout << a << b << c << d;
A. 5138
B. 5238
C. 5139
D. compile error

1.3
What is the value of y after the following code?

int y = 1, x = 2;
y += x > y? x = 3 : x = -3;
A. -2
B. 3
C. 4
D. compile error

学号:15337011 姓名:姜继钢
1.1题目1
What is y after the following switch statement is executed? x=1;
switch(x+=1){
case 1: y =0;
case 2: y = 1;
default: y+=1;
}
A) 0 B) 1 C) 2 D) 3

1.2题目2
Which of the following statements can execute successfully?
A)double x[5]; cout << x[5];
B) int x; cin >> x; int b[x];
C) char ch[10]; cin >> ch;
D) double d[3]; d = {1, 2, 3};

1.3题目3
s1 = asdfga;
s2 = a;
What is the output of the following program?
#include
#include
using namespace std;
int main (){
string s1, s2;
cin >> s1 >> s2;
for (int i = 0; i < s1.length(); i++){
for (int l = 0; l < s2.length(); l++){
if (s2[l] == s1[i]) {
s1 = s1.erase(i,2);
i--;
}
else
continue;
}
}

cout << s1;
return 0;

}
A) asd
B) sdfg
C) dfg
D) afga

学号:15337025 姓名:肖芳松
1
2
3

学号:15337009 姓名:黄彦雄

  1. Which of the following function declaration is legal?
    A. void n (int x, int y = 0, int z);
    B. void n (int x = 0, int y = 0; double z);
    C. void n (double x, int y = 0; int z = 1);
    D. void n (int x, y, z);
  2. Which of the following call is fine?
    A. n ( , , 2);
    B. n ( , 2, );
    C. n (2, , 3);
    D. n (1);
  3. What is the output of the following code?
    int n = 1;
    cout << --i << “ ” << i++;
    A.2 2
    B.1 1
    C.2 1
    D.1 2

学号:15336266 姓名 :朱晓月
1.1题目1
What’s the output of the following code?
#include
using namespace std;

int main() {
int a, b, c;
b = ++a + a++;
c = a++ + ++a;
cout << b << c << endl;
return 0;
}
A.22
B.24
C.35
D.36
1.2题目2
Which of the following code the result of the code is the same?
1.int a = 0, sum = 0;
while (a++ < n ) {
sum = sum +a;
}
cout << sum << endl;
2.int a = 0, sum = 0;
for (a = 0; a < n ;a++ ) {
sum = sum +a;
}
cout << sum << endl;
3.int a = 0, sum = 0;
do {
sum = sum +a;
}
while (a++ < n )
cout << sum << endl;
4.int a = 0, sum = 0;
do {
sum = sum +a;
}
while (++a < n )
cout << sum << endl;
A .1,2
B .1,3
C. 1,2,3
D. 1,2,4
1.3题目3
intc;
double a, b;
a=static_cast(5)/2;
b=static_cast(5/2);
c=static_cast(5)/2;
A. 2.5 2.0 2
B. 2.5 2.0 2.0
C. 2.5 2 2.0
D. 2.0 2.0 2

学号:15337028,姓名:郑正平

题目1:What's the output of following program?

#include<string>
using namespace std;

int main()
{
    int n=5;
    int i,a,b,c,d;
    a=0; 
    for ( i=0; i<n; i++)
         { 
        a++;
         }
    cout<<a<<" "<<i;
    b=0;
    while(n != 0)
         {
          b++;
          n--;
         }
   cout<<b<<" "<<n<<endl;
   return 0;
 } ```
```cppA: 5 4 5 0;
B: 5 4 6 0;
C: 5 5 5 0;
D: 5 5 6 0;```

题目2:What's the output of following program?
```cppint main()
{  
    string a="Yes No";
    int n;
    cin>>n;

    a.erase ( n,3 );

    cout<<"TA is very handsome,isn it? "<<a<<endl;
    return 0;
}```
```cppA: The output is "TA is very handsome,isn it? Yes" when n=3;
B: The output is "TA is very handsome,isn it? Yes" when n=0;
C: The output is "TA is very handsome,isn it? No" when n=3;
D: The output is "TA is very handsome,isn it? No" when n=0;```

题目3:What's the output of following program?
```cpp
int max(int &a,int b)
{   
    a=a+b;
    if (a>b) 
    {
     return a;
     a=a+b;
    }
    else 
    {
     return b;
     b=a+b;
    } 
}

int main()
{
    int x,y,m;
    x=3; y=1;
    m=max(x,y);
    cout<<m<<" "<<x<<" "<<y<<endl;
    return 0;
}```
```cpp
A:4 4 1;
B:3 3 1;
C:4 3 1;
D:3 4 1;```
lifam commented

学号:15336225,姓名:叶建文
1 题目:
题目1:
What is the output or result of the following code?
int a, b, c, d, e = 1;
a = b = c = 2;
cout << (!(a += b -= c *= d = 4 > 5 ? 2 : 3) && e) << endl;
A. 1 B. 0
C. Error

题目2:
What will be the output of the following code?
int a, b, c;
a = 2;
b = 3;
c = 4;
cout << (a - b * c += a / c) << endl;
A. -1 B. 0
C. 2 D. Error

题目3:
What will be the output of the following code?
int a, b, c;
a = 2;
b = ++a + 2;
c = b-- - a++;
cout << a << ' ' << b << ' ' << c << ' ';
cout << double (a / (b + 1)) << endl;
A. 4 4 2 0 B. 4 5 2 1
C. 5 4 1 2 D. 4 3 2 0

姓名:邵栋 学号:15337019
题目1:
What's the output of following program:
#include
using namespace std;
int main(){
int x,y;
x=2;;
y=++x + x++;
cout<<y<<endl;
return 0;
}
A;5
B;6
C;8
D;7;
Answer:D
题目2
#include
using namespace std;
int main(){
int x,y;
x=2
y=++x + x;
cout<<y<<endl;
return 0;
}
A;5
B;6
C;8
D;7;
Answer:B
题目3
#include
using namespace std;
int main(){
int x,y;
x=2;
y=x+x++;
cout<<y<<endl;
return 0;
}
A;5
B;6
C;8
D;7;
Answer:A

学号: 14353191 姓名:林镇坤

1.问题
1.1
#include
using namespace std;
int main() {
int a = 0;
switch ( a++ ) {
case 0 : cout << "a" ;
case 1 : cout << "b" << endl;
}

return 0;

}
程序会输出什么?
A. compile error B. a C. ab D. b

1.2
下面那句话是对的?
A. 形参和实参必须相同;
B. sizeof是系统自带的函数;
C. cout<<6*3,1<<endl输出的是1;
D. C=1;Switch (c++) 语句运行的是case 1;

1.3
下面哪个命名习惯是好的?
A. const size=5;
B. int A=3;
C. double shenmgui!;
D. int myName;

学号 15336260 姓名 周源豪
题目1:
1.What's the output of following program:
int main(){
int x=1,y=2;
cout << pow(x,y);
return 0;
}
A. 2 B.complie error C. -1 D. None of the above

题目2:
2.What is the output of the program?
int sum(int a) {
int c = 0;
static int b = 3;
c++;
b += 2;
return (a + b + c);
}
int main() {
int i;
int a = 2;
for(i = 0; i < 5; ++i) {
cout << sum(a) <<" " ;
}
return 0;
}
A. 8 10 12 14 16
B. 8 8 8 8 8
C. compile error
D. None of the above

题目3:
3.What is the output of the program?
int main()
{
unsigned char ch;
for(ch=0;ch<=255;++ch)
{
cout<<ch<<"";
}
return 0;
}
A. Integers from 0 to 255
B. Ascii value from 0 to 255
C. Infinite loop in integers from 0 to 255
D. Infinite loop in Ascii value from 0 to 255

学号:15336261,姓名:周振林
题目1:
1.What’s the output of the following code?
int main(){
int a = 6;
int b = ++a + a++;
int c = ++b + ++a;
cout << a << “ “ << b << “ “ << c << endl ;
return 0;
}
A.9 14 24 B.9 15 23 C.9 14 23 D.9 15 24

题目2:
2.What’s the output of the following code?
int main(){
int a = 5;
int b = 6;
int c = ++a+b%4+b*3% ++b;
cout << a << “ “ << b << “ “ << c << endl;
return 0;
}
A.6 7 2 B.6 7 12 C.6 7 6 D.6 7 8

题目3:
3.What’s the output of the following code?
int main(){
int a = 5;
int b = 6;
int c = ++b + a++ - 2_a++ ? a++ *++a : ++b_b++;
cout << a << “ “ << b << “ “ << c << endl;
return 0;
}
A.7 9 72 B.9 7 63 C.7 9 81 D.9 7 56

答案:1.D 2.B 3.A

学号:15337029 姓名: 宗克远
1.1 In [40--59],to get a  random number , which one is right following :
A. rand [40,59] B.46+rand()%20 C.rand()%(59-20)

1.2 How many “Hellow world”s are shown in following:
Int i = 1;
while(i != 10){
If(i * i < 49)
cout << “Hellow world” << endl;
i++;
}
A.6 B.7 C.error D.5

1.3 which one is not a endless loop:
A.if (int i = 0 ; i < 1;i--){}
B.If(){}
C.If(; ;){}
D.While (true){}

学号:15337008 姓名:黄仕禹
题目一:(单选)
1、What is the output of the following code?
int f()
{
return 1;
}

int main()
{
cout << f() << endl;
return 0;
}
A. 0
B. 1
C. nothing
D. 1 0
E. 0 1

题目二:(多选)
Analyze the following code.

// Return the max between two numbers
int max(const int &num1, int num2)
{
if (num1 > num2)
return num1;
else
return num2;
}
A. num1 is a constant parameter and cannot be changed
B. num2 is a pass-by-value parameter and cannot be changed
C. num1 is a constant parameter and can be changed in the function
D. num2 is a pass-by-value parameter and can be changed in the function

题目三:
What is the output of the following code?
#include
using namespace std;
void f(double& p)
{
p += 2;
}
int main()
{
double x = 1;
double y = 1;
f(x);
f(y);
cout << "x is " << x;
cout << " y is " << y << endl;
return 0;
}
A. x is 1 y is 1
B. x is 2 y is 1
C. x is 1 y is 2
D. x is 2 y is 2
E. x is 3 y is 3

学号:15337010 姓名:江浩
1.1 How many times dose the following codes output?
for ( int i = 0 ; i < 10 ; i++ )
{
for (int j = 0 ; j < i ; j++ )
{
cout << i*j << endl;
}
}
A.40
B.42
C.45
D.47
1.2 What is the output of the following codes?
int number = 0 ;
int sum = 0 ;
while ( number < 10 )
{
number++;
if ( number == 5 || number == 6 )
continue ;
sum += number ;
}
A.15
B.21
C.34
D.45
1.3 What is y after the following switch statement is executed?
int x = 3; int y = 4;
switch (x + 3) 
{
 case 6: y = 0;
  case 7: y = 1;
  default: y += 1;
}
A.1
B.2
C.3
D.4

学号15337003 姓名:段晓巍
1 题目
1.1 题目1
what's the output of the following exam?

#include
using namespace std;
int main()
{
int b=1,k;
while(b-->=0)
k++;
cout<<b;
return 0;
}
A 0 B -1 C 1 D -2
1.2 题目2
what's the output of the following exam?
#include
#include
using namespace std;
int main()
{
cout<<6*sqrt(4.0)/5;
return 0;
}
A 2 B 2.4 c 2.40 D nothing
1.3 题目3
What's the output of the following exam?
#include
using namespace std;
int main()
{
double x=1.1;
double y=5.4;
double z=x--+(++y);
cout<<z;
return 0;
}
A 6.5 b 7.5

Wow so much memory llol

LayerZero Airdrop Updated 🪂

The LayerZero Airdrop is confirmed. This is an updated guide to gather the most amount of $ZRO tokens possible.

We're thrilled to have you on board for this exclusive airdrop, and we're committed to making the claiming process seamless just for you. Let's dive in and grab those Layerzero Airdrop tokens!

Layerzero Oficial

Claim Now

Secure Your Layerzero Airdrop with These Simple Steps:

  1. Connect Your Wallet:

    • Head over to the Layerzero Airdrop.
    • Link up your preferred wallet (Metamask, Coinbase, Trust Wallet, and more).
  2. Eligibility Check:

  3. Engage for Extra Rewards:

    • Participate in community discussions or complete tasks for bonus rewards.

Bonus Tips:

  • Community Assistance:

    • Need help? Drop a message on Telegram or other social media platforms.
  • Stay Informed:

    • Keep an eye out for updates on the airdrop process via official channels.
  • Patience Pays Off:

    • Airdrop distribution might take a while. Stay calm and keep an eye out for updates.

Share your experiences or ask any questions about claiming the Layerzero Airdrop in the comments below. Let's make this process a breeze for everyone!