就业数据资源平台
当前位置:首页 > 笔试题目
数字笔试题


一、请填写bool , float, 指针变量 与“零值”比较的 if 语句。(10分)


  请写出 bool flag 与“零值”比较的 if 语句。


  if ( flag )


  if ( !flag )


  请写出 float x 与“零值”比较的 if 语句。


  const float epsinon = 0.00001;


  if ((x >= - epsinon) & (x <= epsinon)


  不可将浮点变量用“==”或“!=”与数字比较,应该设法转化成“>=”或“<=”此类形式。


  请写出 char *p 与“零值”比较的 if 语句。


  if (p == null)


  if (p != null)


  二、以下为windows nt下的32位c++程序,请计算sizeof的值(10分)


  char str[] = “hello” ;


  char *p = str ;


  int n = 10;


  请计算


  sizeof (str ) = 6 (2分)


  sizeof ( p ) = 4 (2分)


  sizeof ( n ) = 4


  void func ( char str[100])


  {


  请计算


  sizeof( str ) = 4 (2分)


  }


  void *p = malloc( 100 );


  请计算


  sizeof ( p ) = 4 (2分)

就业数据资源平台