- 論壇徽章:
- 0
|
1 #include “filename.h”和#include <filename.h>;的區(qū)別?
2 頭文件的作用是什么?
3 C++函數(shù)中值的傳遞方式有哪幾種?
4 內(nèi)存的分配方式的分配方式有幾種?
5 實(shí)現(xiàn)雙向鏈表刪除一個(gè)節(jié)點(diǎn)P,在節(jié)點(diǎn)P后插入一個(gè)節(jié)點(diǎn),寫(xiě)出這兩個(gè)函數(shù);
6 寫(xiě)一個(gè)函數(shù),將其中的\t都轉(zhuǎn)換成4個(gè)空格。
7 Windows程序的入口是哪里?寫(xiě)出Windows消息機(jī)制的流程.
8 如何定義和實(shí)現(xiàn)一個(gè)類(lèi)的成員函數(shù)為回調(diào)函數(shù)?
9 C++里面是不是所有的動(dòng)作都是main()引起的?如果不是,請(qǐng)舉例.
10 C++里面如何聲明const void f(void)函數(shù)為C程序中的庫(kù)函數(shù)?
11 下列哪兩個(gè)是等同的
int b;
A const int* a = &
B const* int a = &
C const int* const a = &
D int const* const a = &
12 內(nèi)聯(lián)函數(shù)在編譯時(shí)是否做參數(shù)類(lèi)型檢查
13 三個(gè)float:a,b,c
問(wèn)值
(a+b)+c==(b+a)+c
(a+b)+c==(a+c)+b
14 把一個(gè)鏈表反向填空
15 設(shè)計(jì)一個(gè)重采樣系統(tǒng),說(shuō)明如何anti-alias
16 某個(gè)程序在一個(gè)嵌入式系統(tǒng)(200M的CPU,50M的SDRAM)中已經(jīng)最化了,換到另一個(gè)系統(tǒng)(300M的CPU,50M的SDRAM)中運(yùn)行,還需要優(yōu)化嗎?
17. 下面哪種排序法對(duì)12354最快
a quick sort
b.buble sort
c.merge sort
18. 哪種結(jié)構(gòu),平均來(lái)講,獲取一個(gè)值最快
a. binary tree
b. hash table
c. stack
19 請(qǐng)問(wèn)C++的類(lèi)和C里面的struct有什么區(qū)別?
20 請(qǐng)講一講析構(gòu)函數(shù)和虛函數(shù)的用法和作用?
21 全局變量和局部變量有什么區(qū)別?實(shí)怎么實(shí)現(xiàn)的?操作系統(tǒng)和編譯器是怎么知道的?
22 一些寄存器的題目,主要是尋址和內(nèi)存管理等一些知識(shí)。
23 8086是多少尉的系統(tǒng)?在數(shù)據(jù)總線上是怎么實(shí)現(xiàn)的?
24 多態(tài)。overload 和 override的區(qū)別。
<<Sony筆試題>;>;
25.完成下列程序
*
*.*.
*..*..*..
*...*...*...*...
*....*....*....*....*....
*.....*.....*.....*.....*.....*.....
*......*......*......*......*......*......*......
*.......*.......*.......*.......*.......*.......*.......*.......
#include <stdio.h>;
#define N 8
int main()
{
int i;
int j;
int k;
---------------------------------------------------------
| |
| |
| |
---------------------------------------------------------
return 0;
}
26 完成程序,實(shí)現(xiàn)對(duì)數(shù)組的降序排序
#include <stdio.h>;
void sort( );
int main()
{
int array[]={45,56,76,234,1,34,23,2,3}; //數(shù)字任//意給出
sort( );
return 0;
}
void sort( )
{
____________________________________
| |
| |
|-----------------------------------------------------|
}
27 費(fèi)波那其數(shù)列,1,1,2,3,5……編寫(xiě)程序求第十項(xiàng)?梢杂眠f歸,也可以用其他方法,但要說(shuō)明你選擇的理由。
#include <stdio.h>;
int Pheponatch(int);
int main()
{
printf("The 10th is %d",Pheponatch(10));
return 0;
}
int Pheponatch(int N)
{
--------------------------------
| |
| |
--------------------------------
}
11 下列哪兩個(gè)是等同的
int b;
A const int* a = &
B const* int a = &
C const int* const a = &
D int const* const a = &
12 內(nèi)聯(lián)函數(shù)在編譯時(shí)是否做參數(shù)類(lèi)型檢查
13 三個(gè)float:a,b,c
問(wèn)值
(a+b)+c==(b+a)+c
(a+b)+c==(a+c)+b
14 把一個(gè)鏈表反向填空
15 設(shè)計(jì)一個(gè)重采樣系統(tǒng),說(shuō)明如何anti-alias
16 某個(gè)程序在一個(gè)嵌入式系統(tǒng)(200M的CPU,50M的SDRAM)中已經(jīng)最化了,換到另一個(gè)系統(tǒng)(300M的CPU,50M的SDRAM)中運(yùn)行,還需要優(yōu)化嗎?
17. 下面哪種排序法對(duì)12354最快
a quick sort
b.buble sort
c.merge sort
18. 哪種結(jié)構(gòu),平均來(lái)講,獲取一個(gè)值最快
a. binary tree
b. hash table
c. stack
19 請(qǐng)問(wèn)C++的類(lèi)和C里面的struct有什么區(qū)別?
20 請(qǐng)講一講析構(gòu)函數(shù)和虛函數(shù)的用法和作用?
21 全局變量和局部變量有什么區(qū)別?實(shí)怎么實(shí)現(xiàn)的?操作系統(tǒng)和編譯器是怎么知道的?
22 一些寄存器的題目,主要是尋址和內(nèi)存管理等一些知識(shí)。
23 8086是多少尉的系統(tǒng)?在數(shù)據(jù)總線上是怎么實(shí)現(xiàn)的?
24 多態(tài)。overload 和 override的區(qū)別。
<<Sony筆試題>;>;
25.完成下列程序
*
*.*.
*..*..*..
*...*...*...*...
*....*....*....*....*....
*.....*.....*.....*.....*.....*.....
*......*......*......*......*......*......*......
*.......*.......*.......*.......*.......*.......*.......*.......
#include <stdio.h>;
#define N 8
int main()
{
int i;
int j;
int k;
---------------------------------------------------------
| |
| |
| |
---------------------------------------------------------
return 0;
}
26 完成程序,實(shí)現(xiàn)對(duì)數(shù)組的降序排序
#include <stdio.h>;
void sort( );
int main()
{
int array[]={45,56,76,234,1,34,23,2,3}; //數(shù)字任//意給出
sort( );
return 0;
}
void sort( )
{
____________________________________
| |
| |
|-----------------------------------------------------|
}
27 費(fèi)波那其數(shù)列,1,1,2,3,5……編寫(xiě)程序求第十項(xiàng)。可以用遞歸,也可以用其他方法,但要說(shuō)明你選擇的理由。
#include <stdio.h>;
int Pheponatch(int);
int main()
{
printf("The 10th is %d",Pheponatch(10));
return 0;
}
int Pheponatch(int N)
{
--------------------------------
| |
| |
--------------------------------
}
28 下列程序運(yùn)行時(shí)會(huì)崩潰,請(qǐng)找出錯(cuò)誤并改正,并且說(shuō)明原因。
#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, 數(shù)字任意給出
}
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;
}
}
29. A class B network on the internet has a subnet mask of 255.255.240.0, what is the maximum number of hosts per subnet .
a. 240 b. 255 c. 4094 d. 65534
30. What is the difference: between o(log n) and o(log n^2), where both logarithems have base 2 .
a. o(log n^2) is bigger b. o(log n) is bigger
c. no difference
31. For a class what would happen if we call a class’s constructor from with the same class’s constructor .
a. compilation error b. linking error
c. stack overflow d. none of the above
32. “new” in c++ is a: .
a. library function like malloc in c
b. key word c. operator
d. none of the above
33. Which of the following information is not contained in an inode .
a. file owner b. file size
c. file name d. disk address
34. What’s the number of comparisons in the worst case to merge two sorted lists containing n elements each .
a. 2n b.2n-1 c.2n+1 d.2n-2
35. Time complexity of n algorithm T(n), where n is the input size ,is T(n)=T(n-1)+1/n if n>;1 otherwise 1 the order of this algorithm is .
a. log (n) b. n c. n^2 d. n^n
36. The number of 1’s in the binary representation of 3*4096+ 15*256+5*16+3 are .
a. 8 b. 9 c. 10 d. 12
37.設(shè)計(jì)函數(shù) int atoi(char *s)。
38.int i=(j=4,k=8,l=16,m=32); printf(“%d”, i); 輸出是多少?
39.解釋局部變量、全局變量和靜態(tài)變量的含義。
40.解釋堆和棧的區(qū)別。
41.論述含參數(shù)的宏與函數(shù)的優(yōu)缺點(diǎn)。
42. 以下三條輸出語(yǔ)句分別輸出什么?[C易]
char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha << ( str1==str2 ) << endl; // 輸出什么?
cout << boolalpha << ( str3==str4 ) << endl; // 輸出什么?
cout << boolalpha << ( str5==str6 ) << endl; // 輸出什么?
43. 非C++內(nèi)建型別 A 和 B,在哪幾種情況下B能隱式轉(zhuǎn)化為A?[C++中等]
答:
a. class B : public A { ……} // B公有繼承自A,可以是間接繼承的
b. class B { operator A( ); } // B實(shí)現(xiàn)了隱式轉(zhuǎn)化為A的轉(zhuǎn)化
c. class A { A( const B& ); } // A實(shí)現(xiàn)了non-explicit的參數(shù)為B(可以有其他帶默認(rèn)值的參數(shù))構(gòu)造函數(shù)
d. A& operator= ( const A& ); // 賦值操作,雖不是正宗的隱式類(lèi)型轉(zhuǎn)換,但也可以勉強(qiáng)算一個(gè)
44. 以下代碼中的兩個(gè)sizeof用法有問(wèn)題嗎?[C易]
void UpperCase( char str[] ) // 將 str 中的小寫(xiě)字母轉(zhuǎn)換成大寫(xiě)字母
{
for( size_t i=0; i<sizeof(str)/sizeof(str[0]); ++i )
if( 'a'<=str && str<='z' )
str -= ('a'-'A' );
}
char str[] = "aBcDe";
cout << "str字符長(zhǎng)度為: " << sizeof(str)/sizeof(str[0]) << endl;
UpperCase( str );
cout << str << endl;
45. 以下代碼有什么問(wèn)題?[C難]
void char2Hex( char c ) // 將字符以16進(jìn)制表示
{
char ch = c/0x10 + '0'; if( ch >; '9' ) ch += ('A'-'9'-1);
char cl = c%0x10 + '0'; if( cl >; '9' ) cl += ('A'-'9'-1);
cout << ch << cl << ' ';
}
char str[] = "I love 中國(guó)";
for( size_t i=0; i<strlen(str); ++i )
char2Hex( str );
cout << endl;
46. 以下代碼有什么問(wèn)題?[C++易]
struct Test
{
Test( int ) {}
Test() {}
void fun() {}
};
void main( void )
{
Test a(1);
a.fun();
Test b();
b.fun();
}
47. 以下代碼有什么問(wèn)題?[C++易]
cout << (true?1:"1" << endl;
8. 以下代碼能夠編譯通過(guò)嗎,為什么?[C++易]
unsigned int const size1 = 2;
char str1[ size1 ];
unsigned int temp = 0;
cin >;>; temp;
unsigned int const size2 = temp;
char str2[ size2 ];
48. 以下代碼中的輸出語(yǔ)句輸出0嗎,為什么?[C++易]
struct CLS
{
int m_i;
CLS( int i ) : m_i(i) {}
CLS()
{
CLS(0);
}
};
CLS obj;
cout << obj.m_i << endl;
49. C++中的空類(lèi),默認(rèn)產(chǎn)生哪些類(lèi)成員函數(shù)?[C++易]
答:
class Empty
{
public:
Empty(); // 缺省構(gòu)造函數(shù)
Empty( const Empty& ); // 拷貝構(gòu)造函數(shù)
~Empty(); // 析構(gòu)函數(shù)
Empty& operator=( const Empty& ); // 賦值運(yùn)算符
Empty* operator&(); // 取址運(yùn)算符
const Empty* operator&() const; // 取址運(yùn)算符 const
};
50. 以下兩條輸出語(yǔ)句分別輸出什么?[C++難]
float a = 1.0f;
cout << (int)a << endl;
cout << (int& a << endl;
cout << boolalpha << ( (int)a == (int& a ) << endl; // 輸出什么?
float b = 0.0f;
cout << (int)b << endl;
cout << (int& b << endl;
cout << boolalpha << ( (int)b == (int& b ) << endl; // 輸出什么?
51. 以下反向遍歷array數(shù)組的方法有什么錯(cuò)誤?[STL易]
vector array;
array.push_back( 1 );
array.push_back( 2 );
array.push_back( 3 );
for( vector::size_type i=array.size()-1; i>;=0; --i ) // 反向遍歷array數(shù)組
{
cout << array << endl;
}
52. 以下代碼有什么問(wèn)題?[STL易]
typedef vector IntArray;
IntArray array;
array.push_back( 1 );
array.push_back( 2 );
array.push_back( 2 );
array.push_back( 3 );
// 刪除array數(shù)組中所有的2
for( IntArray::iterator itor=array.begin(); itor!=array.end(); ++itor )
{
if( 2 == *itor ) array.erase( itor );
}
53. 寫(xiě)一個(gè)函數(shù),完成內(nèi)存之間的拷貝。[考慮問(wèn)題是否全面]
答:
void* mymemcpy( void *dest, const void *src, size_t count )
{
char* pdest = static_cast<char*>;( dest );
const char* psrc = static_cast<const char*>;( src );
if( pdest>;psrc && pdest<psrc+cout ) 能考慮到這種情況就行了
{
for( size_t i=count-1; i!=-1; --i )
pdest = psrc;
}
else
{
for( size_t i=0; i<count; ++i )
pdest = psrc;
}
return dest;
}
int main( void )
{
char str[] = "0123456789";
mymemcpy( str+1, str+0, 9 );
cout << str << endl;
system( " ause" );
return 0;
}
54 線程與進(jìn)程的區(qū)別
55:請(qǐng)你分別劃劃OSI的七層網(wǎng)絡(luò)結(jié)構(gòu)圖,和TCP/IP的五層結(jié)構(gòu)圖?
56:請(qǐng)你詳細(xì)的解釋一下IP協(xié)議的定義,在哪個(gè)層上面,主要有什么作用? TCP與UDP呢?
57:請(qǐng)問(wèn)交換機(jī)和路由器分別的實(shí)現(xiàn)原理是什么?分別在哪個(gè)層次上面實(shí)現(xiàn)的?
58:請(qǐng)問(wèn)C++的類(lèi)和C里面的struct有什么區(qū)別?
59:請(qǐng)講一講析構(gòu)函數(shù)和虛函數(shù)的用法和作用?
60:全局變量和局部變量有什么區(qū)別?實(shí)怎么實(shí)現(xiàn)的?操作系統(tǒng)和編譯器是怎么知道的?
61:一些寄存器的題目,主要是尋址和內(nèi)存管理等一些知識(shí)。
62:8086是多少位的系統(tǒng)?在數(shù)據(jù)總線上是怎么實(shí)現(xiàn)的?
<<IBM>;>;
63.怎樣用最快的方法判斷鏈表是否有環(huán)?
64.c++中引用和指針有什么不同?指針加上什么限制等于引用?
65.做的項(xiàng)目,遇到的困難,怎樣解決?
66.在房里有三盞燈,房外有三個(gè)開(kāi)關(guān),在房外看不見(jiàn)房?jī)?nèi)的情況,你只能進(jìn)門(mén)一次,你用什么方法來(lái)區(qū)分那個(gè)開(kāi)關(guān)控制那一盞燈.
67.有兩根不均勻分布的香,每根香燒完的時(shí)間是一個(gè)小時(shí),你能用什么方法來(lái)確定一段15分鐘的時(shí)間.
68. 一個(gè)經(jīng)理有三個(gè)女兒,三個(gè)女兒的年齡加起來(lái)等于13,三個(gè)女兒的年齡乘起來(lái)等于經(jīng)理自己的年齡,有一個(gè)下屬已知道經(jīng)理的年齡,但仍不能確定經(jīng)理三個(gè)女兒的年齡,這時(shí)經(jīng)理說(shuō)只有一個(gè)女兒的頭發(fā)是黑的,然后這個(gè)下屬就知道了經(jīng)理三個(gè)女兒的年齡.請(qǐng)問(wèn)三個(gè)女兒的年齡分別是多少?為什么?
69.操作符重載
class CMyObject:pulic CObject
{
Public:
CMyObject();
CMyObject &operator=(const CMyObject &my);
private:
CString strName;
int nId:
};
請(qǐng)重載賦值操作符
70.鏈表
Struct structList
{
int value;
structList *pHead;
}
Struct LinkedList *pMyList;
請(qǐng)編寫(xiě)刪除鏈表的頭、尾和第n個(gè)節(jié)點(diǎn)的程序
71.用Socket API制作一個(gè)聊天程序,通訊協(xié)議使用tcp/ip。要求有簡(jiǎn)單界面即可,支持多人聊天。
72.如果有過(guò)工作經(jīng)驗(yàn),請(qǐng)說(shuō)明在先前公司的工作以及離職原因(如無(wú),請(qǐng)說(shuō)明畢業(yè)后的個(gè)人展望)
***************************************************************************
73 對(duì)于C++中類(lèi)(class) 與結(jié)構(gòu)(struct)的描述正確的為:
A,類(lèi)中的成員默認(rèn)是private的,當(dāng)是可以聲明為public,private 和protected,結(jié)構(gòu)中定義的成員默認(rèn)的都是public;
B,結(jié)構(gòu)中不允許定義成員函數(shù),當(dāng)是類(lèi)中可以定義成員函數(shù);
C,結(jié)構(gòu)實(shí)例使用malloc() 動(dòng)態(tài)創(chuàng)建,類(lèi)對(duì)象使用new 操作符動(dòng)態(tài)分配內(nèi)存;
D,結(jié)構(gòu)和類(lèi)對(duì)象都必須使用new 創(chuàng)建;
E,結(jié)構(gòu)中不可以定義虛函數(shù),當(dāng)是類(lèi)中可以定義虛函數(shù).
F,結(jié)構(gòu)不可以存在繼承關(guān)系,當(dāng)是類(lèi)可以存在繼承關(guān)系.
答:A,D,F
***************************************************************************
***************************************************************************
74,兩個(gè)互相獨(dú)立的類(lèi):ClassA 和 ClassB,都各自定義了非景泰的公有成員函數(shù) PublicFunc() 和非靜態(tài)的私有成員函數(shù) PrivateFunc();
現(xiàn)在要在ClassA 中增加定義一個(gè)成員函數(shù)ClassA::AdditionalPunction(ClassA a,ClassB b);則可以在AdditionalPunction(ClassA x,ClassB y)的實(shí)現(xiàn)部分(函數(shù)功能體內(nèi)部)
出現(xiàn)的合法的表達(dá)是最全的是:
A,x.PrivateFunc();x.PublicFunc();y.PrivateFunc();y.PublicFunc();
B,x.PrivateFunc();x.PublicFunc();y.PublicFunc();
C,x.PrivateFunc();y.PrivateFunc();y.PublicFunc();
D,x.PublicFunc();y.PublicFunc();
答:B
***************************************************************************
***************************************************************************
75,C++程序下列說(shuō)法正確的有:
A,對(duì)調(diào)用的虛函數(shù)和模板類(lèi)都進(jìn)行遲后編譯.
B,基類(lèi)與子類(lèi)中函數(shù)如果要構(gòu)成虛函數(shù),除了要求在基類(lèi)中用virtual 聲名,而且必須名字相同且參數(shù)類(lèi)型相同返回類(lèi)型相同
C,重載的類(lèi)成員函數(shù)都必須要:或者返回類(lèi)型不同,或者參數(shù)數(shù)目不同,或者參數(shù)序列的類(lèi)型不同.
D,靜態(tài)成員函數(shù)和內(nèi)聯(lián)函數(shù)不能是虛函數(shù),友員函數(shù)和構(gòu)造函數(shù)也不能是虛函數(shù),但是析構(gòu)函數(shù)可以是虛函數(shù).
答:A
***************************************************************************
76,C++中的類(lèi)與結(jié)構(gòu)的區(qū)別?
77,構(gòu)造函數(shù)和析構(gòu)函數(shù)是否可以被重載,為什么?
78,一個(gè)類(lèi)的構(gòu)造函數(shù)和析構(gòu)函數(shù)什么時(shí)候被調(diào)用,是否需要手工調(diào)用? |
|