网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
考虑以下类型转换 short a=1; unsigned int b=a; int c=a; 则b与c的值为?
A.-1,-1
B.-1,1
C.1,1
D.0,0
参考答案和解析
1,1
更多 “考虑以下类型转换 short a=1; unsigned int b=a; int c=a; 则b与c的值为?A.-1,-1B.-1,1C.1,1D.0,0” 相关考题
考题
请编写一个函数unsigned short fun(unsigned short s)。其中s是一个大于10的无符号整数,若s是一个n(n≥2)位整数,函数求出s的n位数之和作为函数的返回值。例如,s值为4315,则函数返回13。s值为13函数,则返回4。注意:部分源程序已存在文件PROC15.cpp中。请勿修改主函数和其他函数中的任何内容,仅在函数fun()的花括号中填写若干语句。文件PROC15.cpp的内容如下://PROC15.cppinclude<iostream>using namespace std;unsigned short fun(unsigned short s);int main(){unsigned short a;cout<<"Enter a unsigned short integer number:";cin>>a;if(a<10)cout<<"Data error!";elsecout<<"The result: "<<fun(a)<<end1;return 0;}unsigned short fun(unsigned short s){//* * * * * *}
考题
下列语句段中,正确的是( )。A.struct{int x;float y;int a[2];unsigned b[3];char name[10];};B.struct stu{unsigned a[3];unsigned b[4];}x;int*p=x.a;C.struct stu{int a;float x[4];}y={1,1.0};float data=y.x;D.struct nd{int a,b;unsigned c[2]=5;};
考题
( 18 )下列各组类型声明符中,含义相同的一组是A ) unsigned long int 和 longB ) signed short int 和 shortC ) unsigned short 和 shortD ) short int 和 int
考题
下列各组类型声明符中,含义相同的一组是A.unsigned long int和longB.signed short int和shortC.unsigned short和shortD.short int和int
考题
Java语言中数值数据的类型能自动转换,按照从左到右的转换次序为()。A.byte→int→short→long→float→doubleB.byte→short→int→long→float→doubleC.byte→short→int→float→long→doubleD.short→byte→int→long→float→double
考题
有以下程序:include main( ){ unsigned int a; int b=-1;a=b;printf(" % u", a);程序
有以下程序: #include <stdio. h> main( ) { unsigned int a; int b=-1; a=b; printf(" % u", a);程序运行后的输出结果是( )。A.-1B.65535C.32767D.-32768
考题
自动类型转换是按优先关系从低级数据转换成高级数据,规定的优先次序是( )。A.byte, short, char→int→long→float→doubleB.float→int→long→byte, short, char→doubleC.int→long→float→double→byte, short, charD.double→int→float→long→byte, short, char
考题
有以下定义和语句,则sizeof(a.share)的值是( )。struct date{ unsigned int day;unsigned int mouth;unsigned int year;union{int share1;float share2;}share;}a;
考题
6 写出下列程序在X86 上的运行结果。struct mybitfields{unsigned short a : 4;unsigned short b : 5;unsigned short c : 7;}testvoid main(void){int i;test.a=2;test.b=3;test.c=0;i=*((short *)test);printf("%d\n",i);}
考题
自动类型转换规定的优先次序是( )。A.short,byte,char→long→int→float→doubleB.short,byte,char→int→long―float→doubleC.byte,short,char→long→int→float→doubleD.byte,short,char→int→long→float→double
考题
下列各组类型声明符中,含义相同的一组是( )。A.unsigned longint和longB.signed short和shortC.unsigned short和shortD.shortint和int
考题
以下程序的结果是 ( ) main( ) { unsigned int a=3,b=10; printf("%d\n",a>1); }A.1B
以下程序的结果是 ( )main( ){ unsigned int a=3,b=10;printf("%d\n",a<<2|b>>1);}A.1B.5C.12D.13
考题
基本数据类型精度从低到高排列正确的是()A.byte short int float doubleB.byte short int double floatC. short byte int float doubleD. short byte int double float
考题
以下n变量赋值必须进行强制类型转换的是( )。A.int n;n=100+10;B.int n;n=100F+10;C.int n;short m=10;n=100+m;D.int n;short m=10;char s=2;n=s+m;
考题
假定编译器规定int和short类型长度分别为32位和16位,执行下列C语言语句: unsigned short a = 65534. unsigned int b ; b =a; 得到b的机器数为(41)。A.00007FFEHB.OOOOFFFEiHC.FFFF7FFEHD.FFFFFFFEH
考题
以下代码中变量result的可能类型有哪些?byte b = 11;short s = 13;result = b * ++s;
A.byte, short, int, long, float, doubleB.boolean, byte, short, char, int, long, float, doubleC.byte, short, char, int, long, float, doubleD.byte, short, charE.int, long, float, double
考题
在C程序中,设一表达式中包含有int,long,char和unsigned类型的变量和数据,这四种类型数据的转换规则是()。A、int→unsigned→long→charB、char→int→long→unsignedC、char→int→unsigned→longD、int→char→unsigned→long
考题
关于数据类型转换下面描述错误的是()A、byte类型数据可以转换为short、int、long类型数据B、long类型数据有可能转换为byte、short、int类型数据C、在语句int i=(int)78.67;中,变量i的值为79D、当两个数据的类型不同一时,必须先进行数据类型的转换,再运算或赋值
考题
单选题关于数据类型转换下面描述错误的是()A
byte类型数据可以转换为short、int、long类型数据B
long类型数据有可能转换为byte、short、int类型数据C
在语句int i=(int)78.67;中,变量i的值为79D
当两个数据的类型不同一时,必须先进行数据类型的转换,再运算或赋值
考题
单选题在C程序中,设一表达式中包含有int,long,char和unsigned类型的变量和数据,这四种类型数据的转换规则是()。A
int→unsigned→long→charB
char→int→long→unsignedC
char→int→unsigned→longD
int→char→unsigned→long
热门标签
最新试卷