假设变量$x=5,则表达式“$x<>4”的返回值类型是()。
第1题:
执行完下列代码段之后: bool x=true, y=false, z=false; x=x&&y‖z; y=x‖y&&z; z=!(x!=y)‖(y-z); 则x=false, y=false, Z=( )。
A.true
B.false
C.不确定
D.异常
第2题:
A.bool('')
B.bool(1)
C.bool(0)
D.bool([])
第3题:
下面程序的结果为_____。
include<iostream.h>
void main( )
{
int a=1,b=2;
bool c=1;
if((a>b) | | c) cout < < "tree" < < endl;
else
cout < < "false" < < endl;
}
第4题:
写出执行完下列代码段之后指定变量的值:
bool x=true ,y=false,z=false;
x=x&&y||z;
y=x||y&&z;
z=!(x!=y)||(y==z);
则x=false,y=【 】,z=【 】。
第5题:
分别写出BOOL,int,float,指针类型的变量a 与
“零”的比较语句。
BOOL : if ( !a ) or if(a)
int : if ( a == 0)
float : const EXPRESSION EXP = 0.000001
if ( a < EXP && a >-EXP)
pointer : if ( a != NULL) or if(a == NULL)
第6题:
请填写 BOOL , float, 指针变量 与“零值”比较的 if 语句.
提示:这里“零值”可以是 0, 0.0 , FALSE 或者“空指针”。例如 int 变量 n 与“零
值
”比较的 if 语句为:
if ( n == 0 )
if ( n != 0 )
以此类推。
请写出 BOOL flag 与“零值”比较的 if 语句:
请写出 float x 与“零值”比较的 if 语句:
请写出 char *p 与“零值”比较的 if 语句:
第7题:
下列定义变量错误的是( )。
A.int al;
B.char chl;
C.int dl=10;
D.bool bll;
第8题:
D3DPRESENT_PARAMETERS参数很多,关于其中参数之一windowed的理解正确的是()
第9题:
如果已经定义了方法int f(bool b, int i),则以下方法中,哪一个不是合法的重载方法()。
第10题:
假设变量bool_x是一个布尔型(逻辑型)的变量,则下面正确的赋值语句是()
第11题:
bool_x=False
bool_x=.FalsE.
bool_x=#False#
bool_x=False
第12题:
bool(false)
bool(true)
int(1)
int(0)
第13题:
A.为true
B.为false
C.与x的值相同
D.与x的值相反
第14题:
有如下的函数定义:
int Xfun(int*a,int n){
int X*a;
for(int*pa=a+1;pa if(*pa>x)x=*pa;
retum x;
}
若在执行了语句:
int x[5]=(23,46,78,55,16);
后,通过表达式Xfun(x,5)调用该函数,则得到的返回值为______。
第15题:
下列函数的功能是判断字符串str是否对称,对称则返回true,否则返回false,则横线处应填上( )。 Bool fun(char*str) { int i=0,j=0; while(str[j])j++; for(j--;i<j&&str[i]==str[j];i++,j--); return i______j; }
A.>==
B.||
C.&&
D.<==
第16题:
有如下程序:
}}}}include<iostream>
using namespace std;
class Pair{
int m;
int n;
public:
Pair(int i,int J):m(i),n(J){}
bool operator>(Pair P)const; //需在类体外给出定义
};
int main(){
Pair pl(3,4),p2(4,3),p3(4,5);
COUt<<(pl>p2)<<(p2>p1)<<(p2>p3)<<(p3>p2);
return 0;
{
运算符函数operator>功能是比较两个Pair对象的大小,当左边对象大时,返回true,否则返回false。比较规则是首先比较两对象的m成员,m大者为大;当m相等时比较n.n大者为大。程序输出0101,下列对运算符重载函数的正确定义是
A.bool Pair::operator>(Pair P)const {if(m!=P.m)return m>P.m;return n>P.n;)
B.bool Pair::operator>(Pair P) {if(m!=P.m)return m>P.m;return n>P.n;)
C.bool Pair::operator>(Pair P)const {if(m>P.m)return true;return 11>P.n;)
D.bool Pair::operator>(Pair P) {if(m>P.m)return true;return 11>P.n;}
第17题:
下面定义的联合类型的长度是( )字节。 Union MyUnion { int x; char ch; float num; bool flag; }
A.4
B.1
C.8
D.2
第18题:
设x,y和z都是int型变量,且x=3,y=4,z=5,则下面表达式中,值为0的表达式是( )。
A.
B.
C.
D.
第19题:
下面程序的结果为______。
include<iostream.h>
void main()
{
int 3=1,b=2;
bool c=1;
if(a>b)||c)cout<<“true”<<endl;
else
cout<<“false”<<endl;
}
第20题:
在C#中下列表达式不正确的是()。
第21题:
bool类型只有2种值,为真(true)和假(false)。()
第22题:
double a,double b=2,int c=3,a=b+c
short a,byte b=2,byte c=3,a=b+c
string a,string b=”1” string c=”2” a=b+c
bool a,bool b=true,bool c=false a=b==c
第23题:
double f(bool b, int i)
int f(double d, int i)
int f(bool b,int i, double d)
double f(bool d, int j)