應屆大學生面試技巧嵌入式方面(3)
作為一個即將畢業的大學生,在外地實習找工作確實是一件很痛苦的事情,我們沒有很強的技能(除過那些很BT的傢伙),沒有一定的社會閲歷,甚至沒有一點家庭背景.但是作為企業來説,他們在很大程度上也都是很瞭解應屆大學生的,他們對我們的要求不是很高,除非有的公司是想刁難你,但是這樣的事情是很少發生的,
我就我在北京的一些找工作的經驗和學習到的一些知識分享給大家,僅代表一家之言,不足之處請大家指正.
操作篇:發些代碼給大家做做筆試參考.
1.下面的代碼輸出是什麼,為什麼?
void foo(void)
{ unsigned int a = 6;
int b = -20;
(a+b > 6) puts("> 6") : puts("<= 6");
}
2.評價下面的代碼片斷:
unsigned int zero = 0;
unsigned int compzero = 0xFFFF;
對於一個int型不是16位的處理器為説,上面的代碼是不正確的。應編寫如下:
unsigned int compzero = ~0;
3.求輸出char *ptr;
if ((ptr = (char *)malloc(0)) == NULL)
puts("Got a null pointer");
else
puts("Got a valid pointer");
4.C語言同意一些令人震驚的結構,下面的結構是合法的嗎,如果是它做些什麼?
int a = 5, b = 7, c;
c = a+++b;
will print out?
main()
{ char *p1=“name”;
char *p2;
p2=(char*)malloc(20);
memset (p2, 0, 20);
while(*p2++ = *p1++);
printf(“%sn”,p2);
}
Answer:empty string.
What will be printed as the result of the operation below:
main()
{ int x=20,y=35;
x=y++ + x++;
y= ++y + ++x;
printf(“%d%dn”,x,y);
}
Answer : 5794
What will be printed as the result of the operation below:
main()
{ int x=5;
printf(“%d,%d,%dn”,x,x<<2,x>>2);
}
Answer: 5,20,1
What will be printed as the result of the operation below:
#define swap(a,b) a=a+b;b=a-b;a=a-b;
void main()
{ int x=5, y=10;
swap (x,y);
printf(“%d %dn”,x,y);
swap2(x,y);
printf(“%d %dn”,x,y);
}
int swap2(int a, int b)
{ int temp;
temp=a;
b=a;
a=temp;
return 0;
}
Answer: 10, 5
10, 5
What will be printed as the result of the operation below:
main()
{ char *ptr = ” Cisco Systems”;
*ptr++; printf(“%sn”,ptr);
ptr++;
printf(“%sn”,ptr);
}
Answer:Cisco Systems
isco systems
What will be printed as the result of the operation below:
main()
{ char s1[]=“Cisco”;
char s2[]= “systems”;
printf(“%s”,s1);
} Answer: Cisco
What will be printed as the result of the operation below:
main()
{ char *p1;
char *p2;
p1=(char *)malloc(25);
p2=(char *)malloc(25);
strcpy(p1,”Cisco”);
strcpy(p2,“systems”);
strcat(p1,p2);
printf(“%s”,p1);
}
Answer: Ciscosystems
The following variable is available in file1.c, who can access it?:
static int average;
Answer: all the functions in the file1.c can access the variable.
WHat will be the result of the following code?
#define TRUE 0 // some code
while(TRUE)
{
// some code
}
Answer: This will not go into the loop as TRUE is defined as 0.
What will be printed as the result of the operation below:
int x;
int modifyvalue()
{ return(x+=10);
} int changevalue(int x)
{ return(x+=1);
}
void main()
{ int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%dn",x);
x++;
changevalue(x);
printf("Second output:%dn",x);
modifyvalue();
printf("Third output:%dn",x);
}
Answer: 12 , 13 , 13
What will be printed as the result of the operation below:
main()
{ int x=10, y=15;
x = x++;
y = ++y;
printf(“%d %dn”,x,y);
}
Answer: 11, 16
What will be printed as the result of the operation below:
main()
{ int a=0;
if(a==0)
printf(“Cisco Systemsn”);
printf(“Cisco Systemsn”);
}
Answer: Two lines with “Cisco Systems” will be printed.
再次更新C++相關題集
6. 以下三條輸出語句分別輸出什麼?[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; // 輸出什麼? 0
cout << boolalpha << ( str3==str4 ) << endl; // 輸出什麼? 0
cout << boolalpha << ( str5==str6 ) << endl; // 輸出什麼? 1
7.寫一個函數,反映出電腦是大端存儲(BIG_ENDER)還是小端存儲(LITTLE_ENDER)?
8.不用庫函數,編寫函數strcmp()和strcat() strcpy()
9.折半查找函數?
fun(int *p)和int fun(int p)區別?
ct
{
bit a;
char b;
int c;
float d;
}a;
求sizeof(a)=?
main(int argc,char *argv[])
{
int c=9,d=0;
c=c++%5;
d=c;
printf("d=%dn",d);
return 0;
}
a) 寫出程序輸出
5
b) 在一個可移植的系統中這種表達式是否存在風險?why?
13 .# include "stdio.h"
int a=0;
int b;
static char c;
int main(int argc,char *argv[])
{
char d=4;
static short e;
a++;
b=100;
c=(char)++a;
e=(++d)++;
printf("a=%d, b=%d, c=%d, d= %d, e=%d",a,b,c,d,e);
return 0;
}
a) 寫出程序輸出
以前學過c++,這個是可以的 e=(++d)++;
現在才發現在c中,這是不行的'
a=2, b=100, c=2, d= 6, e=5
b) 編譯器如果安排各個變量(a,b,c,d)在內存中的佈局(eg. stack,heap,data section,bss section),最好用圖形方式描述。
data section: a
bss section: b,c,e
stack d
在採用段式內存管理的架構中,數據段(data segment)通常是指用來存放程序中已初始化的全局變量的一塊內存區域。數據段屬於靜態內存分配。
在採用段式內存管理的架構中,BSS段(bss segment)通常是指用來存放程序中未初始化的全局變量的一塊內存區域。BSS是英文Block Started by Symbol的簡稱。BSS段屬於靜態內存分配。
-
文藝部面試三分鐘合集8篇
文藝部面試三分鐘1尊敬的領導和老師:我叫xxx,會計系a班學生,來自美麗的瓷都景德鎮,我自薦的學生會職務是文藝部(幹事)。水本無波,相蕩而起漣猗,石本無華,相撞而起火花。融入到學生會這個團體中,除了能以自身所長為同學們服務,還能夠在工作實踐中吸取、借鑑和學習他人長...
-
外企面試的七個禁忌
一忌遲到失約。遲到和失約是面試中的大忌。這不但會表現出求職者沒有時間觀念和責任感,更會令面試官覺得求職者對這份工作沒有熱忱,印象分自然大減。守時不但是美德,更是面試時必須做到的事。因此,應提前10至15分鐘或準時到達。如因有要事遲到或缺席,一定要儘早打電...
-
個人面試自我評價(14篇)
在平日的學習、工作和生活裏,我們都不可避免地要寫自我評價,自我評價是個人對自己思想、願望、行為和個性特點的判斷和評價。那麼自我評價一般是怎麼寫的呢?以下是小編精心整理的個人面試自我評價,僅供參考,大家一起來看看吧。個人面試自我評價1有出色的組織協調本...
-
面試簡歷的自我評價通用15篇
光陰的迅速,一眨眼就過去了,又到了求職找工作的時候,是時候好好地琢磨一下寫簡歷的事情了哦。那麼如何寫簡歷才簡練、明確呢?以下是小編精心整理的面試簡歷的自我評價,僅供參考,大家一起來看看吧。面試簡歷的自我評價1酷愛外貿英語,擁有國家TEM-4和CET-6證書1)熟練操...