2010年8月2日 星期一
華寶面試考題 from ptt
Assume architecture 32-bit
1.
sizeof(char)=?//1
sizeof(char*)=?//4
2.
unsigned short *a = (unsigned short*) 0x0008;
unsgined short *b = a + 1;//0x000a
b=?
3.
int a=1;
int b = (a++) + (++a);//4
b=?
4.
union tt
{
unsigned short a;
unsigned short b[2];
unsigned short c;
}A;
A.a=10;
A.c=20;
A.a=?//20
sizeof(tt)=?//4
5.
int a=3;
do{
printf("%d\n", a-=2);
}while(!(--a));
console output?//1 -2
6.
int a=0x0c0c;
int b = (a>>4) | (a>>4);
b=?
7.
struct node
{
int val;
struct node *next;
}a,b,*p,*q;
p = &a;
q = &b;
請問下列哪個不能linked list
(a)a.next = q; (b) p->next = &b; (c) p.next = q; (d) (*p).next = q;
8.
char a = 45;
以下何者為零?
(a)a|a (b)a&a (c)a^a (d) a!=30 (c)
9.
void f(int a)
{
int b;
switch(a){
case 1:
b=1;
break;
case 2:
b=2;
break;
case 3:
b=3;
//沒有break
default:
b=10;
}
return b;
}
printf("%d", f(3));
what is console output?
1.
sizeof(char)=?//1
sizeof(char*)=?//4
2.
unsigned short *a = (unsigned short*) 0x0008;
unsgined short *b = a + 1;//0x000a
b=?
3.
int a=1;
int b = (a++) + (++a);//4
b=?
4.
union tt
{
unsigned short a;
unsigned short b[2];
unsigned short c;
}A;
A.a=10;
A.c=20;
A.a=?//20
sizeof(tt)=?//4
5.
int a=3;
do{
printf("%d\n", a-=2);
}while(!(--a));
console output?//1 -2
6.
int a=0x0c0c;
int b = (a>>4) | (a>>4);
b=?
7.
struct node
{
int val;
struct node *next;
}a,b,*p,*q;
p = &a;
q = &b;
請問下列哪個不能linked list
(a)a.next = q; (b) p->next = &b; (c) p.next = q; (d) (*p).next = q;
8.
char a = 45;
以下何者為零?
(a)a|a (b)a&a (c)a^a (d) a!=30 (c)
9.
void f(int a)
{
int b;
switch(a){
case 1:
b=1;
break;
case 2:
b=2;
break;
case 3:
b=3;
//沒有break
default:
b=10;
}
return b;
}
printf("%d", f(3));
what is console output?
2010年8月1日 星期日
extern "C"的意義
http://aftcast.pixnet.net/blog/post/22457055
http://translate.google.com.tw/translate?hl=zh-TW&sl=zh-CN&u=http://blog.chinaunix.net/u/29619/showart_230148.html&ei=e1ZWTLr0ONO-rAeG8q3KCA&sa=X&oi=translate&ct=result&resnum=1&ved=0CBoQ7gEwAA&prev=/search%3Fq%3Dextern%2Bc%25E7%2594%25A8%25E6%25B3%2595%26hl%3Dzh-TW%26rlz%3D1C1_____enTW359TW359
http://translate.google.com.tw/translate?hl=zh-TW&sl=zh-CN&u=http://www.xxlinux.com/linux/dev/c/2007-11-23/12560.html&sa=X&oi=translate&resnum=6&ct=result&prev=/search%3Fq%3Dextern%25E7%259A%2584%25E7%2594%25A8%25E6%25B3%2595%26hl%3Dzh-TW%26rlz%3D1B3GGGL_enTW285TW285
2010年7月30日 星期五
2010年7月27日 星期二
2010年7月26日 星期一
訂閱:
文章 (Atom)
