测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

PROBLEM SET

题库

按难度与知识点筛选,找到适合的练习题。

共 67434 题
重置

题目列表

共 67434 题
A20832 在C++ 中,如果声明了一个指针变量但没有显式初始化,该指针会自动被初始化为 nullptr 。( ) C-L4 -- 较难 -- A20833 下面程序执行后输出 2010 。( )int x = 10; void f() { int x = 20; cout << x; } int main() { f(); cout << x; } C-L4 -- 较难 -- A20834 下面程序可以正常编译并输出 10 。( )int calc(int x, int y = 10); int calc(int x) { return x * 2; } int calc(int x, int y) { return x * y; } int main() { cout << calc(5); } C-L4 -- 较难 -- A20835 执行下面代码,输出结果为 5 。( )int main() { int a[2][3]; cout << &a[1][2] - &a[0][1] << endl; return 0; } C-L4 -- 较难 -- A20836 引用一旦绑定某个变量,就不能再绑定其他变量。( ) C-L4 -- 较难 -- A20837 下面代码执行结束时,变量 a 的值变成 15。( )void add10(int &x) { x += 10; } int main() { int a = 5; add10(a); } C-L4 -- 较难 -- A20838 下列函数实现排行榜中单个元素的位置调整(类似插⼊排序的相邻搬移)。当某玩家分数增加,需将其向前移动时, while 循环的条件应为( )。struct Player{ int score; }; void up(Player players[], int n, int idx){ Player cur = players[idx]; int i = idx; while( ___________… C-L4 -- 较难 -- A20839 执行下面程序,输出结果是( )。int divi(int a, int b){ if(b == 0) throw 0; return a / b; } int main(){ try{ cout << divi(10, 0); }catch(const char* msg){ cout << "A"; }catch(int){ cout << "B"; } } C-L4 -- 较难 -- A20840 下面哪种方式不能实现将字符串Welcome to 2026!输出重定向到文件 Log.txt( )。 C-L4 -- 较难 -- A20841 下列代码段的时间复杂度为( )。int cnt=0; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if( (i+j) % 3 == 0 ) cnt++; } } C-L4 -- 较难 -- A20842 下面代码试图把数组按升序进行“插⼊排序”,横线处应填写( )。void ins(int a[], int n){ for(int i = 1; i < n; i++){ int key = a[i]; int j = i-1; while(j >= 0 && ____________){ a[j+1] = a[j]; j--; } a[j+1] = key; } } C-L4 -- 较难 -- A20844 执 行climb(6)的返回值为( )。int climb(int n){ if(n <= 2) return n; int a = 1, b = 2, c = 0; for(int i = 3; i <= n; i++){ c = a + b; a = b; b = c; } return c; } C-L4 -- 较难 -- A20845 关于递推算法的描述,正确的是( )。 C-L4 -- 较难 -- A20846 执行下面代码后输出为( )。struct S { int a; int b; }; void g(S s){ s.a += 10; } void h(S& s){ s.b += 10; } int main(){ S s{1,2}; g(s); h(s); cout << s.a << " " << s.b; } C-L4 -- 较难 -- A20847 下列关于结构体初始化的写法,正确的是( )。 C-L4 -- 较难 -- A20848 执行下面程序后输出为( )。int x = 3; void f(int& x){ x += 2; } int main(){ int x = 10; f(x); cout << x << " " << ::x; } C-L4 -- 较难 -- A20849 执行下面程序后,输出为( )。void fun(int a, int &b, int *c){ a += 1; b += 2; *c += 3; } int main(){ int x = 1, y = 1, z = 1; fun(x, y, &z); cout << x << " " << y << " " << z; } C-L4 -- 较难 -- A20850 已知:int a[3][4] = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12} }; int (*p)[4] = a;则表达式*(*(p+2)+1)的值为( )。 C-L4 -- 较难 -- A20851 执行下面代码后,输出为( )。int main() { int a = 5; int* p = &a; int** q = &p; **q += 7; cout << a << " " << *p; } C-L4 -- 较难 -- A20852 执行下面程序后,输出为( )。int f(int x = 2){ return x * 3; } int main(){ cout << f() << " " << f(4); } C-L4 -- 较难 --