通过海量题库、编程比赛和实时排名,系统化提升您的编程能力。
第1题
下面选项中关于位运算的叙述正确的是( )。
位运算符都需要两个操作数
位运算的对象只能是整型或字符型数据
左移运算的结果总是原操作数据2倍
右移运算时,高位总是补0
第2题
下面关于位运算符的叙述,正确的是
#表示"按位异或"的运算
|表示"按位或"的运算
~表示"按位异或"的运算
&表示"按位与"的运算
第3题
以下不属于C语言位运算符的是( )。
!
||
^
~
第4题
以下选项中错误的是( )。
a&=b与a=a & b等价
a^=b与a=a^b等价
a|=b与a=a|b等价
a!=b与a=a!b等价
第5题
变量a中的数据用二进制表示的形式是01011101,变量b中的数据用 二进制表示的形式是11110000。若要求将a的高4位取反,低4位不变, 所要执行的运算是( )。
a^b
a|b
a&b
a<<4
第6题
若有定义语句
int b=2;
则表达式(b<<2)/(3ǁb)的值是( )。
8
2
4
0
第7题
设有定义:
int a=64,b=8;
则表达式(a&b)ǁ(a&&b)和(a|b) && (aǁb)的值分别为( )。
1和1
1和0
0和1
0和0
第8题
有以下程序:
#include <stdio.h> main() { int a=3; int b=3; printf("%d\n", a&b);}
程序运行后的输出结果是( )。
6
1
3
第9题
#include <stdio.h> main() { int c,d; c=13&5; d=10&&5; printf("%d,%d\n",c,d); }
程序的运行结果是( )。
5,1
1,1
18,1
13,1
第10题
有以下函数:
#include <stdio.h> main() { int a=12,c; c=(a<<2)<<1; printf("%d\n",c); }
50
96
第11题
#include <stdio.h> main() { int a=2,b; b=a<<2; printf("%d\n",b); }
第12题
有以下程序
#include <stdio.h> void main() { unsigned char a=8, c; c = a>>3; printf("%d\n",c); }
32
16
第13题
#include <stdio.h> main(){ short c=124; c=c______; printf("%d\n",c); }
若要使程序的运行结果为248,应在下画线处填入的是( )。
>>2
|248
&0248
<<1
第14题
#include <stdio.h> main() { int a=2,b=2,c=2; printf("%d\n",a/b&c); }
程序运行后的结果是( )。
第15题
#include <stdio.h> main() { int a=1,b=2,c=3,x; x=(a^b)&c; printf("%d\n",x); }
第16题
#include <stdio.h> main() { int c,d; c=10^3; d=10+3; printf("%d,%d\n",c,d);}
103,13
13,13
10,13
9,13
第17题
若有以下程序段:
int r=8; printf("%d\n",r>>1);
输出结果是( )。
第18题
#include <stdio.h> main() { int a=5,b=1,t; t=(a<<2)|b; printf("%d\n",t); }
21
11
第19题
#include <stdio.h> main() { char a=4; printf("%d\n",a=a<<1); }
程序运行的结果是( )。
40
第20题
设有以下语句
int a=1,b=2,c; c=a^(b<<2);
执行后,c的值为( )。
9
7
第21题
#include <stdio.h> main() { unsigned char a=2,b=4,c=5,d; d=a|b; d&=c; printf("%d\n",d); }
5
第22题
#include <stdio.h> main() { int i=1; i=i^i; printf("%d\n",i); }
-1
第23题
若变量已正确定义,则以下语句的输出结果是( )。
s=32; s^=32; printf(″%d″,s);
第24题
有如下程序:
#include <stdio.h> main() { int a=8,b; b=(a>>2)%2; printf("%d,%d\n",a,b); }
8,0
4,0
4,1
8,1
第25题
#include <stdio.h> main() { int a=9,b; b=(a>>3)%4; printf("%d,%d\n",a,b); }
9,1
4,3
9,3
第26题
#include <stdio.h> main() { int c,d; c=(13>>1)|1; d=(13>1)||1; printf("%d,%d\n",c,d); }
6,1
7,1
7,2
第27题
#include <stdio.h> main() { char c='A'; int x=36,b; b=(x>>2)&&(c<'a'); printf("%d\n",b); }
第28题
有以下程序:
#include <stdio.h> main( ) { int i, array[6] = {1, 5, 0, 4}; for (i=0; i<5; i++) printf("%d,", array[i] & 4); printf("\n"); }
1,2,1,2,0,
1,5,0,4,0,
1,5,5,4,0,
0,4,0,4,0,
第29题
#include main() { int i, array[5]={3,5,10,4}; for(i=0;i<5;i++)printf("%d,",array[i]&3); printf("\n"); }
3,1,2,0,0,
3,5,10,4,0,
3,3,3,3,0,
3,2,2,2,0,
选择题(1 - 29题,共计100分)