为C程序员准备的0x10个最佳问题

为C程序员准备的0x10个最佳问题

日期:2006-10-23 11:59:17  点击:64  作者:  来源:Paid King

整个测试遵循以下的约定:

u       假定在所有的程序中必须的头文件都已经被正确包含。

考虑如下的数据类型:

u       char 1个字节

u       int 4个字节 数据挖掘工具

u       long int 4个字节 数据挖掘论坛

u       float 4个字节

数据挖掘论坛

u       double 为个8字节 数据挖掘论坛

u       long double 8个字节

数据挖掘工具

u       指针为4个字节

数据挖掘论坛

  数据挖掘论坛

数据挖掘实验室

 

数据挖掘交友

1. Consider the following program:

数据挖掘实验室

#include<setjmp.h>

static jmp_buf  buf;

数据挖掘论坛

  数据挖掘研究院

数据挖掘工具

main()

数据挖掘论坛

{

数据挖掘研究院

  volatile  int b;

  b =3;

数据挖掘实验室

  数据挖掘工具

数据挖掘工具

  if(setjmp(buf)!=0) 

数据挖掘交友

  {

    printf("%d ", b); 

数据挖掘实验室

    exit(0);

  }

数据挖掘研究院

  b=5;

数据挖掘工具

  longjmp(buf , 1);

}

数据挖掘研究院

The output for this program is:  

(a) 3
(b) 5
(c) 0
(d) None of the above

数据挖掘论坛

2. Consider the following program:

数据挖掘实验室

main()

数据挖掘研究院

{

   struct node

数据挖掘工具

   {

数据挖掘交友

     int a;

数据挖掘实验室

     int b;

数据挖掘工具

     int c;    

数据挖掘论坛

   };

数据挖掘论坛

   struct node  s= { 3, 5,6 };

   struct node *pt = &s;

数据挖掘研究院

   printf("%d" ,  *(int*)pt);

}

The output for this program is:
(a) 3
(b) 5
(c) 6
(d) 7

数据挖掘研究院

3. Consider the following code segment:

int  foo ( int x , int  n)

数据挖掘实验室

{

数据挖掘论坛

  int val;

数据挖掘论坛

  val =1;

数据挖掘交友

 

数据挖掘工具

  if (n>0)

数据挖掘研究院

  {

数据挖掘论坛

    if (n%2 == 1)  val = val *x;

数据挖掘论坛

   

数据挖掘研究院

    val = val * foo(x*x , n/2);

数据挖掘实验室

  }

数据挖掘工具

  return val;

}

What function of x and n is compute by this code segment?   

数据挖掘研究院

(a) x^n
(b) x*n
(c) n^x
(d) None of the above

4. Consider the following program:

数据挖掘工具

main()

数据挖掘工具

{

  int  a[5] = {1,2,3,4,5};

数据挖掘工具

  int *ptr =  (int*)(&a+1);

数据挖掘实验室

  数据挖掘实验室

数据挖掘研究院

  printf("%d %d" , *(a+1), *(ptr-1) );

数据挖掘研究院

 

数据挖掘论坛

}

The output for this program is:

(a) 2 2
(b) 2 1
(c) 2 5
(d) None of the above

数据挖掘研究院

5. Consider the following program:

数据挖掘研究院

void foo(int [][3] );    

数据挖掘论坛

  数据挖掘研究院

数据挖掘工具

main()

数据挖掘实验室

{

数据挖掘研究院

  int a [3][3]= { { 1,2,3} , { 4,5,6},{7,8,9}};

  foo(a);

  printf("%d" , a[2][1]);

数据挖掘实验室

}

数据挖掘实验室

 

数据挖掘工具

void foo( int b[][3])

{

  ++ b;

数据挖掘工具

  b[1][1] =9;

数据挖掘交友

}

数据挖掘研究院

The output for this program is:
(a) 8
(b) 9
(c) 7
(d) None of the above

6. Consider the following program:

数据挖掘交友

main()

数据挖掘交友

{

数据挖掘实验室

  int a, b,c, d;

数据挖掘工具

  a=3;

数据挖掘实验室

  b=5;

数据挖掘论坛

  c=a,b;

数据挖掘交友

  d=(a,b);

  数据挖掘论坛

数据挖掘研究院

  printf("c=%d" ,c);

数据挖掘工具

  printf("d=%d" ,d);

  数据挖掘实验室

数据挖掘研究院

}

The output for this program is:

(a) c=3 d=3
(b) c=5 d=3
(c) c=3 d=5
(d) c=5 d=5

数据挖掘工具

7. Consider the following program:

数据挖掘实验室

main()

数据挖掘论坛

{

数据挖掘工具

  int a[][3] = { 1,2,3 ,4,5,6};

数据挖掘交友

  int (*ptr)[3] =a;

数据挖掘论坛

  数据挖掘工具

数据挖掘工具

  printf("%d %d "  ,(*ptr)[1], (*ptr)[2] );

数据挖掘研究院

  数据挖掘研究院

数据挖掘实验室

  ++ptr;

数据挖掘交友

  printf("%d %d"  ,(*ptr)[1], (*ptr)[2] );

}

数据挖掘论坛

The output for this program is:

(a) 2 3 5 6
(b) 2 3 4 5
(c) 4 5 0 0
(d) None of the above

数据挖掘实验室

8. Consider following function

数据挖掘论坛

int *f1(void)

数据挖掘论坛

{

  int x =10;

数据挖掘研究院

  return(&x);

}

数据挖掘工具

  数据挖掘研究院

数据挖掘研究院

int *f2(void)

数据挖掘论坛

{

数据挖掘研究院

  int*ptr;

  *ptr =10;

  return ptr;

数据挖掘工具

}

数据挖掘研究院

 

int *f3(void)

数据挖掘研究院

{

数据挖掘论坛

  int *ptr;

数据挖掘实验室

  ptr=(int*) malloc(sizeof(int));

数据挖掘研究院

[数据挖掘专家] [数据挖掘研究院] [数据挖掘论坛] [数据挖掘实验室]
上一篇:使用C#开发SmartPhone程序入门
下一篇:汇总c#.net常用函数和方法集
最新评论共有 0 位网友发表了评论 , 查看所有评论
发表评论( 不能超过250字,需审核,请自觉遵守互联网相关政策法规。 )
匿名?
数据挖掘网站导航 数据挖掘论坛导航
  • 数据挖掘工具
  • 数据挖掘论坛
  • DataCruncher - Cognos
  • MineSet - MathSoft
  • Intelligent Miner - GainSmarts
  • Sqlserver - SAS - Clementine
  • CART - Weka - WizSoft
  • NeuroShell - ModelQuest
  • data mining tools - Darwin
  • 数据挖掘交友
  • 数据挖掘博客
  • 数据挖掘工具
  • 数据挖掘资源
  • 数据挖掘技术算法
  • 数据挖掘相关期刊、会议
  • 研究院联盟合作专区
  • 数据挖掘基础与相关技术
  • 数据挖掘厂商与就业
  • 数据挖掘研究者乐园
  • 知名厂商数据挖掘工具资料
  • 国内数据挖掘实验室
  • Foreign Data Mining Lab
  • 热点关注
  • 挑战C#学习的最快速度
  • C#模仿QQ截图功能
  • C# 关于开机自动运行程序方式之一
  • 第一章 C#简介
  • 利用C#实现分布式数据库查询
  • Visual Studio 2005 Hands-On Tutorial - P
  • C#入门代码
  • .NET架构与模式探索
  • 用C#代码编写的SN快速输入工具
  • C# 关于开机自动运行程序方式之一
  • 论坛最新话题
  • Foundations of Statistical Natural Langu
  • Game Theory meet Data Mining: A Recent P
  • System Building: How does it help or hin
  • 数据挖掘与Clementine培训
  • 新手报到
  • 求 SASEM 客户流失预测分析
  • 数据挖掘工程师/搜索研究院—北京——无线
  • 数据挖掘入门介绍(如何着手数据挖掘)
  • Information Overload Survey Results
  • The INEX 2005 Workshop on Element Retrie
  • 相关资讯
  • 彻底剖析C# 2.0泛型类的创建和使用
  • 对C# 2.0中匿名方法的怀疑分析
  • EasySP管理解决方案基于Microsoft .NET架构
  • .NET架构与模式探索
  • .NET架构的核心开发技术
  • 用C#代码编写的SN快速输入工具
  • C#链接数据库技巧
  • C#设计模式编程之抽象工厂模式新解
  • 第一章 C#简介
  • 第七章 异常处理
  • 数据挖掘实验室资料
  • 数据挖掘博客地址
  • 数据挖掘实验室网站地址
  • Prepare for Medicare audits by using dat
  • 注册成为SAS用户与爱好者俱乐部会员
  • 水南梅
  • 明日烟
  • 新人报道
  • 下载
  • 厦门服务器托管,450元/月—0592-5177319 高
  • 买空间送域名--0592-5177319 高静