创维(精华)笔试题目

进修社 人气:2.04W

 
是当时面创维数字的笔试题,题目比较简单,只涉及到了基本的C语法,没有考到数据结构以及算法,试题在前面说明这套题并不能反映应聘者实际的软件开发及编程能力。

创维(精华)笔试题目

一、请填写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分)


三、简答题(25分)

1、头文件中的 ifndef/define/endif 干什么用?(5分)

答:防止该头文件被重复引用。

2、#include <filename.h> 和 #include “filename.h” 有什么区别?(5分)

答:对于#include <filename.h> ,编译器从标准库路径开始搜索 filename.h

   对于#include   “filename.h” ,编译器从用户的工作路径开始搜索 filename.h
3、const 有什么用途?(请至少说明两种)(5分)