找回密码
 注册
搜索
查看: 1460|回复: 2

[资料] 据说某手机公司的笔试题(c语言),有兴趣的看看

[复制链接]
发表于 2006-11-10 08:31:48 | 显示全部楼层 |阅读模式
1.      Write a function that prints the binary representation of an unsigned integer using only putchar() for output

2.      Memory Management/Pointer manipulation
Write a function that allows you to remove a substring from a string and returns a new string that uses only the amount of storage needed
Assume: All arguments are always valid
     The original string should remain untouched
Use the following function prototype
char * remove_substr(char *str, int pos, int length);

3.      Data structures
Implement a circular queue of size n using an array. Use the given fragments for your implementation
  typedef stuct QUEUE{
         int head, tail;
         void * data[N];
  }queue;
  
  void init-queue()
  {
  }
  
  int queue(void *data)
  {
  }
  void * dequeue()
  {
  }

4.      Problem solving/operating systems
A multitasking OS has a producer program that writes data to a buffer and consumer one that reads that data and prints it. Show the work that needs to be done to make sure this works smoothly.

5.      C syntax
Identify all the errors in the following piece of C code. Assuming you fix it so it compiles correctly. What would it print? (be sure to specify any assumptions)
  void init_array(unsigned int array[])
  {
         int size = sizeof(array);
         int i;
         for(i=0; i<size; i++)
         array=-1;
  }
  void main()
  {
         char * string=”Here is rather long constant to fit my needs”;
         char * another_string;
         unsigned int array[11];
         init_array(&array[0]);
         another_string=(char*)malloc(strlen(string));
         strcpy(another_string,string);
         for(i=0; i<=40; i+=4){
         array[i/4]=int(*)string;
         printf(“%s”, (char *) array);
    }
发表于 2007-3-14 20:52:47 | 显示全部楼层
不错嘛,考核得挺全面的
点评回复

使用道具 举报

发表于 2007-6-18 09:40:23 | 显示全部楼层
高手写答案[em06][em06]
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-12-24 10:19 , Processed in 0.066255 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表