外企技术面试题

1.From secure programming perspective, which line of the following code has problem?         

line 1:     int main ( int argc, char* argv [] )

line 2:     {

line 3:        char buff [32];

line 4:        if ( argc != 2 ) return ( -1 );

line 5:        strncpy (buff, argv[1], sizeof(buff));

line 6         exit(0);

line 7:     }

 

A. Line 3

B. Line 4

C. Line 5

D. Line 6

2.Which is the correct description of the static data member of a class in C++ language? 

A.  The static data member is allocated in heap. 

B.  The static data member exists before any object of this class is created. 

C.  The static data member in a class has different value in respective instance of this class. 

D.  The declaration for a static data member of a class is as below: 

3.

class A 

 

protected: 

static int nVariable = 0; 

 

class B : public A  

public: 

B() Funcl(); ; 

      void Funcl(){ cout<< B: : Funcl  is  called! <<endl; }; 

      void Func2(int n){ cout<< B: : Func2  is  called! <<endl; }; 

; 

void main(void){ 

A a, *pa; 

B b; 

pa=&b; 

       pa->Funcl(); 

       pa->Func2(); 

 

A.  A::Func1 is called! 

    A::Func1 is called! 

    A::Func2 is called! 

B.  A::Func1 is called! 

    A::Func1 is called! 

    B::Func2 is called! 

C.  A::Func1 is called! 

    B::Func1 is called! 

    A::Func2 is called! 

D.  B::Func1 is called! 

    A::Func1 is called! 

    A::Func2 is called! 

E.  B::Func1 is called! 

    A::Func1 is called! 

    B::Func2 is called! 

F.  B::Func1 is called! 

    B::Func1 is called! 

A::Func2 is called!

 

4.What is the output of the following C code when running on 32-bit system?

#include <stdio.h> 

#include <malloc.h> 

int main(void)  

char array[5] = {0}; 

char *pa = array; 

char *pb = (char*)malloc(5) ; 

printf( %d, %d, %d/n ,  sizeof(array), sizeof(pa), sizeof(pb)); 

free(pb); 

return 0; 

} 

A. 5, 5, 5 

B. 4, 4, 5 

C. 5, 4, 4 

D. 4, 5, 4

5.What's the output of below code in 32-bit little endian system? 

#include <stdio.h>

typedef union A{ 

  short a;

  char b[2];

  long c;

} UNION_A; 

int main(void){ 

  UNION_A a;

  a.b[0] = 10;

  a.b[1] = 1;

  printf("%d, %d", a.a, sizeof(a));

  return 0;

} 

A. 266, 2 

B. 266, 4 

C. 2561, 2 

D. 2561, 4

6.If the system RAM memory address is valid from 0x10000000 to 0x20000000, what’s the behavior of running below code in 32-bit system? 

#include <iostream.h> 

using namespace std; 

int main(void){ 

  int *pvalue = (int*) 0x10000003;

  *pvalue = 0x01020304;

cout << *pvalue << endl; 

return 0;

} 

A. 0x020304; 

B. 0x01020304 

C. 0x01 

D. Exception

7.If taking the following definitions, how can we call the CObject toString method in CCircle class? 

class CObject { 

public: 

  virtual void toString(){

   // do something..

  }

}; 

class CCircle : public CObject{ 

public: 

  void toString(){

  __________

  }

} 

A.  toString();

B.  ((CObject*)this)->toString();

C.  CObject::toString();

D.  CObject obj; 

    obj.toString();

8.Which protocol could be at the lowest layer?

A. ICMP

B. UDP

C. ARP

D. HTTP

9.Which one of below is NOT the functionality of IP layer?

A. Receive a message to send from a higher-level protocol layer such as TCP or UDP

B. Place the message in an IP datagram that consists of an IP header, followed by the message to send

C. Pass the datagram to a lower layer such as an Ethernet driver which sends the datagram on the network

D. Send the data, name the port that will use the data at the destination, handshake to inform the source whether the destination received the data

10.In linux kernel, which state is for a blocked process?

A. TASK_INTERRUPTIBLE

B. TASK_UNINTERRUPTIBLE

C. TASK_KILLABLE

D. All of the above

11.Which statements of below are true in term of priority inversion in real-time system? (Multiple choices)

A. Have at least 3 tasks with different priority

B. Have at least 2 tasks with different priority

C. A shared resource that may block requesting tasks

D. Can be resolved by priority ceiling or priority inheritance algorithm

12.For what kind of device, Linux can NOT access it through the file in /dev

A. Character device

B. Block device

C. Network interface

D. All of the above

13.Which statements below are the possible reasons that can cause a thread been suspended? (Multiple choice)

a) Higher priority task is ready

b) An interrupt occur

c) The thread is waiting a message

d) Thread is in progress of I/O operation

14.How to change the access permissions of the specified files or directories?

A. more

B. ps

C. chmod

D. fsck

15.Which of the following mechanisms should be used when multiple processes need to communicate and the communicated item need be accessed randomly?

A. Shared memory

B. Message queue

C. Pipe

16.In UNIX system,if file A has the permission of 0740, the same group's users of file A may do:

A. Read A only

B. Write A

C. Execute A

D. Non-operation

17.In network interface driver, which function can send the packet received to protocol layer?

A. register_netdev

B. netif_rx

C. ioremap

D. net_pkg_route

18.Which device can put JFFS2 file system above it?

A. /dev/mtd0

B. /dev/mtdblock0

C. /sys/bus/mtd0

D. /dev/ram0

19.In linux kernel, which struct is used to descibe the charactor device?

A. Struct cdev

B. Struct net_device

C. Struct file_operations

D. Struct char_dev

20.In linux kernel module,which macro is used to define a module parameter?

A. MODULE_AUTHOR

B. MODULE_LICENSE

C. MODULE_ALIAS_MISCDEV

D. module_param

21.In linux kernel, which function is used to covert physical address to virtual address?

A. mmap

B. malloc

C. ioremap

D. ioctl

22.In linux kernel, which struct is used to USB transfer?

A. skb

B. urb

C. cdev

D. udev

23.which is the default syslog level for printk()?

A. KERN_INFO

B. KERN_DEBUG

C. KERN_WARN

D. KERN_EMERG

24.In linux tty subsystem, bluetooth protocol is located in?

A. tty core

B. tty line discipline

C. tty driver

D. tty device

25.Which function should be used when we want to enable hardware interrupt, but disable software interrupt in spin lock?

A. spin_lock

B. spin_lock_irqsave

C. spin_lock_irq

D. spin_lock_bh

26.How can we use disk partition to store hibernate image?

A. make this partition as swap and enable swap on it

B. make this partition as swap but disable swap on it

C. fill this partition with magic number

D. make ext2 file system on this partition and mount it to /hibernate

27.In linux driver, when request_irq, which flag is used to quick irq?

A. SA_INTERRUPT

B. SA_SHIRQ

C. SA_QUICKIRQ

D. SA_IRQ

28.Which function shall block when call?

A. bind

B. listen

C. accept

D. socket

29.What's the behavior of signal for NPTL thread?

A. signal send to the whole process

B. signal send to the main thread

C. signal send to random thread

D. signal send to all threads except the main thread

30.Which type of linux kernel image can be boot by u-boot "bootm" command?

A. zImage

B. bzImage

C. vmlinux

D. uImage

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值