URN Logo
UNIX Resources » Linux » China Linux Forum » C/C++编程版 » 23 » C/C++面试会有些什么题目?
announcement 声明: 本页内容为中国Linux论坛的内容镜像,文章的版权以及其他所有的相关权利属于中国Linux论坛和相应文章的作者,如果转载,请注明文章来源及相关版权信息。
Resources
China Linux Forum(finished)
Linux Forum(finished)
FreeBSD China(finished)
linuxforum.net
  业界新闻与评论
  自由软件杂谈
  IT 人生
  Linux软件快递
  翻译作坊
  Linux图书与评论
  GNU Emacs/XEmacs
  Linux 中文环境和中文化
  Linux桌面与办公软件
  Linux 多媒体与娱乐版
  自由之窗Mozilla
  笔记本电脑上的Linux
  Gentoo
  Debian 一族
  网络管理技术
  Linux 安装与入门
  WEB服务器和FTP服务器
  域名服务器和邮件服务器
  Linux防火墙和代理服务器应用
  文件及打印服务器
  技术培训与认证
  Linux内核技术
  Linux 嵌入技术
  Linux设备驱动程序
  Linux 集群技术
  LINUX平台数据库
  系统和网络安全
  CPU 与 编译器
  系统计算研究所专栏
  Linux下的GUI软件开发
  C/C++编程版
  PHP 技 术
  Java&jsp技术
  Shell编程技术
  Perl 编 程
  Python 编 程
  XML/Web Service 技术
  永远的Unix
  FreeBSD世界
   
C/C++面试会有些什么题目?
C/C++面试会有些什么题目? - zhhhuang [2005-10-22 13:32 | 45 byte(s)]
 
ZT:CS面试题目 - keyboard [2005-10-24 13:36 | 7,191 byte(s)]
 
Subject: C/C++面试会有些什么题目?
Author: zhhhuang    Posted: 2005-10-22 13:32    Length: 45 byte(s)
[Original] [Print] [Top]
有经验的介绍一下,好像有道关于指针/数组很经典
----
[Original] [Print] [Top]
Subject: ZT:CS面试题目
Author: keyboard    Posted: 2005-10-24 13:36    Length: 7,191 byte(s)
[Original] [Print] [Top]
1) How to implement the linux pipe feature in java?
2) How to implement a queue using two stacks?
3) Given a file of URLs, how to find the top 10 most popular domains? If the file is really large (containing tens of millions of URLs), and we don't want to know the exact top 10 most popular domains, what is the quickest way to find the approximate top 10 most popular domains?
4) How do you efficiently right-shift an array with the least memory usage? For example, the original array could be 2 3 4 5 6, after right-shift 2 positions, it should be 5 6 2 3 4. The function prototype is shift_right(int[] arr, int shiftCount).
5) How to efficiently store a billion URLs?
6) Given an array of integers, say 3,2,4,6,5,7,20,1, efficiently find all the pairs of integers that add up to 8?
7) Given an array of a million integers, how to find the top ten largest integers efficiently?
8) Given the expression 5*( ( (6+8) * (9+2))*2 ), transform it to postfix format, and then use a stack to evaluate it.
9) Write a program to parse the expression 5*( ( (6+8) * (9+2))*2 ) into a tree and evaluate it. Hint: recursive descent parsing and implicit tree
10)Given two very large list of numbers, write a program to perform the union operation of the two lists, i.e., merge the two lists together into one.
11)Write a function that returns the 5th element from the end in a singly linked list of integers. The function has one argument: a pointer to the head node of the linked list.
12)Write a function to remove the duplicate items in-place, return the new size of the array.
int RemoveDuplicates(char rg[]);
int RemoveDuplicates(short rg[]);
int RemoveDuplicates(int rgNum[]);
13)Write a program to efficiently find the number of 1s in a very large bitset (say with size of 1 million)
14)Given an array of 1’s and 0’s – can you tell me how I can get all the 0’s to the left side of the array and all the 1’s to the right?
15)Given a dictionary of words, find all the anagrams for a particular word efficiently. For example, my dictionary contains the following words: pot", "opt", "top", "tall", "app", "pap", the anagram for the word "pot" should be "opt", "top".
16)Write a program to efficiently calculate n^m. The function prototype is: long pow(int n, int m).
17)How google might implement the "Did you mean" feature? (i.e., the user typo would result in a "Did you mean" suggestion.)
18)How could computers generate random numbers when all programs are written by human being?
19)Given an array that contains both positive and negative integers, find the sub-array with the largest sum.
20)Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it.
21)Given an array of characters which form a sentence of words, given an efficient algorithm to reverse the order of the words (not characters) in it.
22)Reverse a linked list.
23)Insert in a sorted list.
24)In a X's and 0's game (i.e. TIC TAC TOE) if you write a program for this give a fast way to generate the moves by the computer. This should be the fastest way possible.
25)Give a fast way to multiply a number by 7.
26)Write a small lexical analyzer - interviewer gave tokens. expressions like "a*b" etc.
27)Assuming that locks are the only reason due to which deadlocks can occur in a system. What would be a foolproof method of avoiding deadlocks in the system.
28)Ways of optimizing symbol table storage in compilers.
29)How is the readers-writers problem solved?
30)Write an efficient algorithm and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
31)Given an array of characters. How would you reverse it? How would you reverse it without using indexing in the array.
32)Do a breadth first traversal of a tree.
33)Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).
34)Sort an array of size n containing integers between 1 and K, given a temporary scratch integer array of size K.
35)An array of size k contains integers between 1 and n. You are given an additional scratch array of size n. Compress the original array by removing duplicates in it. What if k << n?
36)An array of integers of size n. Generate a random permutation of the array, given a function rand_n() that returns an integer between 1 and n, both inclusive, with equal probability. What is the expected time of your algorithm?
37)An array of pointers to (very long) strings. Find pointers to the (lexicographically) smallest and largest strings.
38)Write a program to remove duplicates from a sorted array.
39)C++ ( what is virtual function ? what happens if an error occurs in constructor or destructor. Discussion on error handling, templates, unique features of C++. What is different in C++ ( compare with unix).
40)Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list).
41)Describe the file system layout in the Linux OS
42)In UNIX, are the files allocated contiguous blocks of data? If not, how is the fragmented data kept track of?
43)Write an efficient C code for 'tr' program. 'tr' has two command line arguments. They both are strings of same length. tr reads an input file, replaces each character in the first string with the corresponding character in the second string. eg. 'tr abc xyz' replaces all 'a's by 'x's, 'b's by 'y's and so on.
44)What is the scope of a static function in C?
45)What is the difference between "malloc" and "calloc"?
46)Given a singly linked list, determine whether it contains a loop or not.
47)Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space?
48)Reverse a singly linked list recursively.
49)Given a singly linked list, find the middle of the list.
50)Given an array of 100 integers, each array element stores a unique integer in the range of [1-101]. Find which integer in 1-101 is missing in the array.
51)given a sorted array of n integers, find the integer k in the array.
52)Given a binary tree, print out the binary tree level by level.
53)Reverse the bits of an unsigned integer.
54)How do we test most simply if an unsigned integer is a power of two?
55)Exchange two integer variables without a temporary variable? (hint: use XOR, for example, A^B^B=A)
56)Set the highest significant bit of an unsigned integer to zero.
----
\ {[<~!@#$%^&*()_-+=|:;"',./>]}?
[Original] [Print] [Top]
« Previous thread
eclipse + cdt 写c++程序时,失去响应,cpu和内存占用率急速上升,怎么回事??(附图
C/C++编程版
23
Next thread »
带命令行参数用gdb如何调试
     

Copyright © 2007 UNIX Resources Network, All Rights Reserved.      About URN | Privacy & Legal | Help | Contact us
备案序号: 京ICP备05006143    webmaster: webmaster@unixresources.net
This page created on 2008-07-17 03:52:32, cost 0.038409948348999 ms.