freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c常見筆試題及答案-文庫吧

2025-06-09 18:50 本頁面


【正文】 nd(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))。NewNodevalue=N。if(root==NULL){root=NewNode。return。}else{TNode* temp。temp=root。while((N= amp。amp。 !=NULL) || (Ntemp. value amp。amp。 !=NULL)){while(N= amp。amp。 !=NULL)temp=。while(N amp。amp。 !=NULL)temp=。}if(N=)=NewNode。else=NewNode。return。 }}29. A class B network on the internet has a subnet mask of , what is the maximum number of hosts per subnet .a. 240 b. 255 c. 4094 d. 6553430. 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 biggerc. no difference31. For a class what would happen if we call a class’s constructor from with the same class’s constructor .a. pilation error b. linking errorc. stack overflow d. none of the above32. “new” in c++ is a: .a. library function like malloc in cb. key word c. operatord. none of the above33. Which of the following information is not contained in an inode .a. file owner b. file sizec. file name d. disk address34. What’s the number of parisons in the worst case to merge two sorted lists containing n elements each .a. 2n +1 35. Time plexity of n algorithm T(n), where n is the input size ,is T(n)=T(n1)+1/n if n1 otherwise 1 the order of this algorithm is .a. log (n) b. n c. n^2 d. n^n36. 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. 1237.設計函數(shù) int atoi(char *s)。 38.int i=(j=4,k=8,l=16,m=32)。 printf(“%d”, i)。 輸出是多少? 39.解釋局部變量、全局變量和靜態(tài)變量的含義。 40.解釋堆和棧的區(qū)別。 棧區(qū)(stack)— 由編譯器自動分配釋放 ,存放函數(shù)的參數(shù)值,局部變量的值等。其操作方式類似于數(shù)據(jù)結(jié)構(gòu)中的棧。堆:一般由程序員分配釋放, 若程序員不釋放,程序結(jié)束時可能由OS回收 。注意它與數(shù)據(jù)結(jié)構(gòu)中的堆是兩回事,分配方式倒是類似于鏈表.41.論述含參數(shù)的宏與函數(shù)的優(yōu)缺點。 ,先求出實參表達式的值,然后帶入形參。而使用帶參的宏只是進行簡單的字符替換。,分配臨時的內(nèi)存單元;而宏展開則是在編譯時進行的,在展開時并不分配內(nèi)存單元,不進行值的傳遞處理,也沒有“返回值”的概念。,二者的類型要求一致,如不一致,應進行類型轉(zhuǎn)換;而宏不存在類型問題,宏名無類型,它的參數(shù)也無類型,只是一個符號代表,展開時帶入指定的字符即可。宏定義時,字符串可以是任何類型的數(shù)據(jù)。,而用宏可以設法得到幾個結(jié)果。,宏展開后源程序長,因為每展開一次都使程序增長,而函數(shù)調(diào)用不使源程序變長。,只占編譯時間;而函數(shù)調(diào)用則占運行時間(分配單元、保留現(xiàn)場、值傳遞、返回)。 一般來說,用宏來代表簡短的表達式比較合適。42. 以下三條輸出語句分別輸出什么?[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。 // 輸出什么?0cout boolalpha ( str3==str4 ) endl。 // 輸出什么?0cout boolalpha ( str5==str6 ) endl。 // 輸出什么?1答:分別輸出false,false,true。str1和str2都是字符數(shù)組,每個都有其自己的存儲區(qū),它們的值則是各存儲區(qū)首地址,不等;str3和str4同上,只是按const語義,它們所指向的數(shù)據(jù)區(qū)不能修改。str5和str6并非數(shù)組而是字符指針,并不分配存儲區(qū),其后的“abc”以常量形式存于靜態(tài)數(shù)據(jù)區(qū),而它們自己僅是指向該區(qū)首地址的指針,相等。43. 非C++內(nèi)建型別 A 和 B,在哪幾種情況下B能隱式轉(zhuǎn)化為A?[C++中等]答:BDa. class B : public A { ……} // B公有繼承自A,可以是間接繼承的b. class B { operator A( )。 } // B實現(xiàn)了隱式轉(zhuǎn)化為A的轉(zhuǎn)化c. class A { A( const Bamp。 )。 } // A實現(xiàn)了nonexplicit的參數(shù)為B(可以有其他帶默認值的參數(shù))構(gòu)造函數(shù)d. Aamp。 operator= ( const Aamp。 )。 // 賦值操作,雖不是正宗的隱式類型轉(zhuǎn)換,但也可以勉強算一個44. 以下代碼中的兩個sizeof用法有問題嗎?[C易]void UpperCase( char str[] ) // 將 str 中的小寫字母轉(zhuǎn)換成大寫字母{for( size_t i=0。 isizeof(str)/sizeof(str[0])。 ++i )if( 39。a39。=str[i] amp。amp。 str[i]=39。z39。 )str[i] = (39。a39。39。A39。 )。}char str[] = aBcDe。cout str字符長度為: sizeof(str)/sizeof(str[0]) endl。UpperCase( str )。cout str endl。45. 以下代碼有什么問題?[C難]void char2Hex( char c ) // 將字符以16進制表示{char ch = c/0x10 + 39。039。 if( ch 39。939。 ) ch += (39。A39。39。939。1)。char cl = c%0x10 + 39。039。 if( cl 39。939。 ) cl += (39。A39。39。939。1)。cout ch cl 39。 39。}char str[] = I love 中國。for( size_t i=0。 istrlen(str)。 ++i )char2Hex( str[i] )。cout endl。46. 以下代碼有什么問題?[C++易]struct Test{Test( int ) {}Test() {}void fun() {}}。void main( void ){Test a(1)。()。Test b()。()。}*** Test b()。//定義了一個函數(shù)47. 以下代碼有什么問題?[C++易]cout (true?1:1) endl。8. 以下代碼能夠編譯通過嗎,為什么?[C++易]unsigned int const size1 = 2。char str1[ size1 ]。unsigned int temp = 0。cin temp。unsigned int const size2 = temp。char str2[ size2 ]。48. 以下代碼中的輸出語句輸出0嗎,為什么?[C++易]struct CLS{int m_i。CLS( int i ) : m_i(i) {}CLS(){CLS(0)。}}。CLS obj。cout endl。49. C++中的空類,默認產(chǎn)生哪些類成員函數(shù)?[C++易]答:class Empty{public:Empty()。 // 缺省構(gòu)造函數(shù)Empty( const Emptyamp。 )。 // 拷貝構(gòu)造函數(shù)~Empty()。 // 析構(gòu)函數(shù)Emptyamp。 operator=( const Emptyamp。 )。 // 賦值運算符Empty* operatoramp。()。 // 取址運算符const Empty* operatoramp。() const。 // 取址運算符 const}。50. 以下兩條輸出語句分別輸出什么?[C++難]float a = 。cout (int)a endl。cout (intamp。)a endl。cout boolalpha ( (int)a == (intamp。)a ) endl。 // 輸出什么0float b = 。cout (int)b endl。cout (intamp。)b endl。cout boolalpha ( (int)b == (intamp。)b ) endl。 // 輸出151. 以下反向遍歷array數(shù)組的方法有什么錯誤?[STL易]vector array。( 1 )。( 2 )。( 3 )。for( vector::size_type i=()1。 i=0。 i ) // 反向遍歷array數(shù)組{cout array[i] endl。}52. 以下代碼有什么問題?[STL易]typedef vector IntArray。IntArray array。( 1 )。( 2 )。( 2 )。( 3 )。// 刪除array數(shù)組中所有的2for( IntArray::iterator itor=()。 itor!=()。 ++itor ){if( 2 == *itor ) ( itor )。}53. 寫一個函數(shù),完成內(nèi)存之間的拷貝。[考慮問題是否全面]答:void* mymemcpy( void *dest, const void *src, size_t count ){char* pdest = static_castchar*( dest )。const char* psrc = static_castconst char*( src )。if( pdestpsrc amp。amp。 pdestpsrc+cout ) 能考慮到這種情況就行了{for( size_t i=count1。 i!=1。 i )pdest[i] = psrc[i]。}else{for( size_t i=0。 icount。 ++i )pdest[i] = psrc[i]。}return dest。}int main( void ){char str[] = 0123456789。mymemcpy( str+1, str+0, 9 )。cout str endl。system( Pause )。return 0。}54 線程與進程的區(qū)別進程就是一個應用程序在處理機上的一次執(zhí)行過程,它是一個動態(tài)的概念,而線程是進程中的一部分,進程包含多個線程在運行。55:請你分別劃劃OSI(開放式系統(tǒng)互聯(lián))的七層網(wǎng)絡結(jié)構(gòu)圖,和TCP/IP的五層結(jié)構(gòu)圖? 56:請你詳細的解釋一下IP協(xié)議的定義,在哪個層上面,主要有什么作用? TCP與UDP呢? IP協(xié)議是網(wǎng)絡層的協(xié)議,它實現(xiàn)了Internet中自動路由的功能,即尋徑的功能,TCP協(xié)議是一個傳輸性的協(xié)議它向下屏蔽了IP協(xié)議不可靠傳輸?shù)奶匦?,向上提供一個可靠的點到點的傳輸,UDP提供的是一種無連接的服務,主要考慮到很多應用不需要可靠的連接,但需要快速的傳輸57:請問交換機和路由器分別的實現(xiàn)原理是什么?分別在哪個層次上面實現(xiàn)的?
點擊復制文檔內(nèi)容
范文總結(jié)相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1