用户名: 密码: 企业 个人
当前位置:89学习网范文文章招聘应聘笔试Sony技术类笔试题及分析» 正文

Sony技术类笔试题及分析

[10-16 20:00:41]   来源:http://www.89xue.com  笔试   阅读:90
摘要: 1.完成下列程序**.*.*..*..*..*...*...*...*...*....*....*....*....*....*.....*.....*.....*.....*.....*.....*......*......*......*......*......*......*......*.......*.......*.......*.......*.......*.......*.......*.......#include#define N 8int main(){int i;int j;int k;-││││││-return 0;}答:#define N 8int main(){int i;i。
Sony技术类笔试题及分析,标签:笔试范文,http://www.89xue.com

   1.完成下列程序

  *

  *.*.

  *..*..*..

  *...*...*...*...

  *....*....*....*....*....

  *.....*.....*.....*.....*.....*.....

  *......*......*......*......*......*......*......

  *.......*.......*.......*.......*.......*.......*.......*.......

  #include

  #define N 8

  int main()

  {

  int i;

  int j;

  int k;

  ---------------------------------------------------------

  ││││││

  ---------------------------------------------------------

  return 0;

  }

  答:

  #define N 8

  int main()

  {

  int i;

  int j;

  int k;

  for(i=0;i{

  for(j=0;j{

  printf("*");

  for(k=0;kprintf(".");

  }

  printf("\n");

  }

  return 0;

  }

  2.完成程序,实现对数组的降序排序

  #include

  void sort( );

  int main()

  {

  int array[]={45,56,76,234,1,34,23,2,3}; //数字任意给出

  sort( );

  return 0;

  }

  void sort( )

  {

  ---------------------------------------------------------

  ││││││

  ---------------------------------------------------------

  }

  答:使用选择排序法,我为sort函数多加了两个形参,至少第一个是必须的,否则无法传入待排序数组。不知道这样做是否符合题意。

  void sort(int *array,int num)

  {

  int temp;

  for(int i=0;ifor(int j=i+1;jif (array{

  temp=array;

  array=array[j];

  array[j]=temp;

  }

  }

  3.菲波纳契数列,1,1,2,3,5……编写程序求第十项。可以用递归,也可以用其他方法,但要说明你选择的理由。

  #include

  int Pheponatch(int);

  int main()

  {

  printf("The 10th is %d",Pheponatch(10));

  return 0;

  }

  int Pheponatch(int N)

  {

  --------------------------------

  ││││

  --------------------------------

  }

  答:使用递归,理由是递归编程简单,代码容易理解,但缺点是效率不高,而且有深度限制,如果深度太深,则堆栈会溢出。

  int Pheponatch(int N)

  {

  if (N==3)

  return 2;

  else if (N==2||N==1)

  return 1;

  else

  return Pheponatch(N-1)+Pheponatch(N-2);

  }

  4.下列程序运行时会崩溃,请找出错误并改正,并且说明原因。

  #include

  #include

  typedef struct TNode

  {

  TNode* left;

  TNode* right;

  int value;

  }TNode;

  TNode* root=NULL;

  void append(int N);

  int main()

  {

  append(63);

  append(45);

  append(32);

  append(77);

  append(96);

  append(21);

  append(17); // Again, 数字任意给出

  return 0;

  }

  void append(int N)

  {

  TNode* NewNode=(TNode *)malloc(sizeof(TNode));

  NewNode->value=N;

  NewNode->left=NULL; //新增

  NewNode->right=NULL; //新增

  if(root==NULL)

  {

  root=NewNode;

  return;

  }

  else

  {

  TNode* temp;

  temp=root;

[1] [2]  下一页


Tag:笔试笔试范文招聘应聘 - 笔试