⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 笔试面试题整理.txt

📁 IT面试笔试题集锦 笔试面试题整理 IT面试笔试题集锦 看看就知道了
💻 TXT
📖 第 1 页 / 共 2 页
字号:
 }
 s.size = i;
 s.a[i] = '\0';
 return is;
}


int main(){
 String a = "abcd";
 String b = "www";
 //String c(6,b);这么写不对.
    String c(6,'l');
 String d;
 String e = a;//abcd
 String f;
 cin >> f;//需要输入...
 String g;
 g = a + b;//abcdwww

 if(a < b)
  cout << "a < b" << endl;
 else
  cout << "a >= b" << endl;
 if(e == a)
  cout << "e == a" << endl;
 else
  cout << "e != a" << endl;
 
 b += a;
 
 cout << a << endl;
 cout << b << endl;
    cout << c << endl;
 cout << d << endl;
 cout << e << endl;
 cout << f << endl;
 cout << g << endl;
 cout << g[0] << endl;
 return 0;
}


 

 

4. Implement a single-direction linked list sorting algorithm. Please first define the data structure of linked list and then implement the sorting algorithm. 

 

5.编写一个函数,返回两个字符串的最大公串!例如,“adbccadebbca”和“edabccadece”,返回“ccade”

 

联想笔试题
  1.设计函数 int atoi(char *s)。

 int atoi(const char *nptr);
 函数说明
 atoi()会扫描参数nptr字符串,跳过前面的空格字符,直到遇上数字或正负符号才开始做转换,而再 遇到非数字或字符串结束时('\0')才结束转换,并将结果返回。
返回值 返回转换后的整型数。

#include <stdio.h>
#include <ctype.h>

int myAtoi(const char* s){
 int result = 0;
 int flag = 1;
 int i = 0;
 while(isspace(s[i]))
  i++;
 if(s[i] == '-'){
  flag = -1;
  i++;
 }
 if(s[i] == '+')
  i++;
 while(s[i] != '\0'){
  if((s[i] > '9') || (s[i] < '0'))
   break;
  int j = s[i] - '0';
  result = 10 * result + j;
  i++;
 }
 result = result * flag;
 return result;
}

int main(){
 char* a = "   -1234def";
 char* b = "+1234";
 int i = myAtoi(a);
 int j = myAtoi(b);
 printf("%d \n",i);
 printf("%d",j);
 return 0;
}


 






  2.int i=(j=4,k=8,l=16,m=32); printf(“%d”, i); 输出是多少?
  3.解释局部变量、全局变量和静态变量的含义。
  4.解释堆和栈的区别。
  5.论述含参数的宏与函数的优缺点。
  普天C++笔试题
  1.实现双向链表删除一个节点P,在节点P后插入一个节点,写出这两个函数。
  2.写一个函数,将其中的\t都转换成4个空格。
  3.Windows程序的入口是哪里?写出Windows消息机制的流程。
  4.如何定义和实现一个类的成员函数为回调函数?
  5.C++里面是不是所有的动作都是main()引起的?如果不是,请举例。
  6.C++里面如何声明const void f(void)函数为C程序中的库函数?
  7.下列哪两个是等同的
  int b;
  A const int* a = &b;
  B const* int a = &b;
  C const int* const a = &b;
  D int const* const a = &b;
  8.内联函数在编译时是否做参数类型检查?
  void g(base & b){
   b.play;
  }
  void main(){
   son s;
   g(s);
   return;
  }
华为笔试题
  1.请你分别画出OSI的七层网络结构图和TCP/IP的五层结构图。
  2.请你详细地解释一下IP协议的定义,在哪个层上面?主要有什么作用?TCP与UDP呢?
  3.请问交换机和路由器各自的实现原理是什么?分别在哪个层次上面实现的?
  4.请问C++的类和C里面的struct有什么区别?
  5.请讲一讲析构函数和虚函数的用法和作用。
  6.全局变量和局部变量有什么区别?是怎么实现的?操作系统和编译器是怎么知道的?
  7.8086是多少位的系统?在数据总线上是怎么实现的?
Sony笔试题
  1.完成下列程序
  *
  *.*.
  *..*..*..
  *...*...*...*...
  *....*....*....*....*....
  *.....*.....*.....*.....*.....*.....
  *......*......*......*......*......*......*......
  *.......*.......*.......*.......*.......*.......*.......*.......
  #include <stdio.h>
  #define N 8
  int main()
  {
   int i;
   int j;
   int k;
   ---------------------------------------------------------
   | |
   | |
   | |
   ---------------------------------------------------------
   return 0;
  }
  2.完成程序,实现对数组的降序排序
  #include <stdio.h>
  void sort( );
  int main()
  {
   int array[]={45,56,76,234,1,34,23,2,3}; //数字任//意给出
   sort( );
   return 0;
  }
  void sort( )
  {
   ____________________________________
   | |
   | |
   |-----------------------------------------------------|
  }
  3.费波那其数列,1,1,2,3,5……编写程序求第十项。可以用递归,也可以用其他方法,但要说明你选择的理由。
  #include <stdio.h>
  int Pheponatch(int);
  int main()
  {
   printf("The 10th is %d",Pheponatch(10));
   return 0;
  }
  int Pheponatch(int N)
  {
  --------------------------------
  | |
  | |
  --------------------------------
  }
  4.下列程序运行时会崩溃,请找出错误并改正,并且说明原因。
  #include <stdio.h>
  #include <malloc.h>
  typedef struct{
   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, 数字任意给出
  }
  void append(int N)
  {
   TNode* NewNode=(TNode *)malloc(sizeof(TNode));
   NewNode->value=N;
  
   if(root==NULL)
   {
   root=NewNode;
   return;
   }
   else
   {
   TNode* temp;
   temp=root;
   while((N>=temp.value && temp.left!=NULL) || (N<temp. value && temp. right!=NULL
  ))
   {
   while(N>=temp.value && temp.left!=NULL)
   temp=temp.left;
   while(N<temp.value && temp.right!=NULL)
   temp=temp.right;
   }
   if(N>=temp.value)
   temp.left=NewNode;
   else
   temp.right=NewNode;
   return;
   }
  }


MSRA Interview Written Exam(December 2003,Time:2.5 Hours) 


1写出下列算法的时间复杂度。 
(1)冒泡排序; 
(2)选择排序; 
(3)插入排序; 
(4)快速排序; 
(5)堆排序; 
(6)归并排序; 

2写出下列程序在X86上的运行结果。 

struct mybitfields 
{ 
unsigned short a : 4; 
unsigned short b : 5; 
unsigned short c : 7; 
}test 

void main(void)  
{ 
int i; 
test.a=2; 
test.b=3; 
test.c=0; 

i=*((short *)&test); 
printf("%d\n",i); 
} 

3写出下列程序的运行结果。 

unsigned int i=3; 
cout<<i * -1; 

4写出下列程序所有可能的运行结果。 

int a; 
int b; 
int c; 

void F1() 
{ 
b=a*2; 
a=b; 
} 

void F2() 
{ 
c=a+1; 
a=c; 
} 

main() 
{ 
a=5; 
//Start F1,F2 in parallel 
F1(); F2(); 
printf("a=%d\n",a); 
} 

5考察了一个CharPrev()函数的作用。 

6对 16 Bits colors的处理,要求: 
(1)Byte转换为RGB时,保留高5、6bits; 
(2)RGB转换为Byte时,第2、3位置零。 

7一个链表的操作,注意代码的健壮和安全性。要求: 
(1)增加一个元素; 
(2)获得头元素; 
(3)弹出头元素(获得值并删除)。 

8一个给定的数值由左边开始升位到右边第N位,如 
0010<<1 == 0100 
或者 
0001 0011<<4 == 0011 0000 
请用C或者C++或者其他X86上能运行的程序实现。 

附加题(只有在完成以上题目后,才获准回答) 
In C++, what does "explicit" mean? what does "protected" mean? 

1。在C++中有没有纯虚构造函数? 
2。在c++的一个类中声明一个static成员变量有没有用? 
3。在C++的一个类中声明一个静态成员函数有没有用? 
4。如何实现一个非阻塞的socket? 
5。setsockopt, ioctl都可以对socket的属性进行设置,他们有什么不同? 
6。解释一下进程和线程的区别? 
7。解释一下多播(组播)和广播的含义? 
8。多播采用的协议是什么? 
9。在c++中纯虚析构函数的作用是什么?请举例说明。 
10。编程,请实现一个c语言中类似atoi的函数功能(输入可能包含非数字和空格)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -