外企技术面试题_what鈥檚 the output of below code on a 64-bit system-程序员宅基地

技术标签: 10_笔/面试题集锦分析  

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

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xiaopangzi313/article/details/9275013

智能推荐

容器三把斧之 | cgroup原理与实现_struct list_headtasks;-程序员宅基地

文章浏览阅读1.6k次,点赞5次,收藏12次。前面我们介绍了CGroup的使用与基本概念,接下来将通过分析源码(本文使用的 Linux2.6.25 版本)来介绍CGroup的实现原理。在分析源码前,我们先介绍几个重要的数据结构,因为CGroup就是通过这几个数据结构来控制进程组对各种资源的使用。cgroup结构体前面介绍过,cgroup是用来控制进程组对各种资源的使用,而在内核中,cgroup是通过cgroup结构体来描述的,我们来看看其定义:structcgroup{unsignedlongfla..._struct list_headtasks;

SpringMVC初认识_兔头程序员-程序员宅基地

文章浏览阅读164次。SpringMVCMVC1. 什么是MVC?MVC是一种框架模式,是Model View Controller(模型-视图-控制器)的缩写。Model 模型数据模型,提供要展示的数据,用于封装数据View 视图展示数据Controller 控制器控制模型的数据要在哪一个视图展示2. 作用MVC模式使展示与模型分离,流程控制逻辑、业务逻辑调用与展示分离。最终实现系统的职能分工。3. 优缺点优点耦合性低重用性高生命周期成本低部署快可维护性高有利于软件工程化管理_兔头程序员

Svchost.exe进程详解及Svchost.exe病毒清除方法_svchost.exe -k rpcss-程序员宅基地

文章浏览阅读2.3w次,点赞3次,收藏18次。这几天在宿舍上网的时候其他的舍友反映网络特别的卡。不知道是什么原因。然后我就发现自己的电脑有一个程序,自己走流量而且每秒能达100kb以上对于宿舍8个人共用的一个4M的网线来说已经算是占了好大一部分网速了。在金山流量监控上发现这个程序叫Svchost.exe。这是一个什么程序呢。然后我就尝试禁用。但我发现win7的任务管理器的进程中是找不到这个进程的。然后我通过上网了解了这个进程。 s_svchost.exe -k rpcss

java中修改对象类的数据_Java基础09 类数据与类方法-程序员宅基地

文章浏览阅读728次。我们一直是为了产生对象而定义类(class)的。对象是具有功能的实体,而类是对象的类型分类。这是面向对象的一个基本概念。在继承(inheritance)中,我们将类当做可以拓展的主体,这提高了我们对“类”的认识。类本身还有许多值得讨论的地方。我们将继续深入。static数据成员有一些数据用于表述类的状态。比如Human类,我们可以用“人口”来表示Human类的对象的总数。“人口”直接描述类的状态,..._java中如何用方法来改变一个类的值

hdu 2066:一个人的旅行_输入数据:每组的第一行是三个整数t,s和d,表示有t条路,和去往临近城市高铁站、火车-程序员宅基地

文章浏览阅读448次。草儿决定要在最短的时间去一个自己想去的地方,因为草儿的家在一个小镇上,没有火车经过,所以她只能去邻近的城市坐火车。多组输入数据,每组的第一行是三个整数T,S和D,表示有T条路,和草儿家相邻的城市的有S个,草儿想去的地方有D个;接着有T行,每行有三个整数a,b,time,表示a,b城市之间的车程是time小时;(1=接着的第T+1行有S个数,表示和草儿家相连的城市;接着的第T+2行有D个_输入数据:每组的第一行是三个整数t,s和d,表示有t条路,和去往临近城市高铁站、火车

java统计字符串中每个字符出现的次数_java string 统计某个字符出现的次数-程序员宅基地

文章浏览阅读6.3w次,点赞33次,收藏76次。例如String str = “abcaaaefdabbhg”; 统计该字符串中每个字符出现的次数,输出: a====5 b====3 c====1 d====1 e====1 f====1 g====1 h====1方法一: 采用HashMappublic static void count(String str){ //将字符串转化为字符数组_java string 统计某个字符出现的次数

随便推点

python 数据存储方式_数据存储是什么python-程序员宅基地

文章浏览阅读1.9k次。blog.csdn.net/ffblog/article/details/46558051一.序列1.用于存储一系列的数据2.在内存中,序列就是一块用于存放多个值的连续的内存空间如a=[10,20,30,40]存储示意:3.python中序列结构:str,list,tuple,dict,set..._数据存储是什么python

【语音去噪】IIR+FIR滤波器语音信号去噪(含滤波前后对比图)【含Matlab源码 4062期】-程序员宅基地

文章浏览阅读354次,点赞4次,收藏4次。IIR+FIR滤波器语音信号去噪(含滤波前后对比图)完整的代码,包运行;运行操作视频见CSDN资源!适合小白!

Tensorflow-hub[例子解析1]-程序员宅基地

文章浏览阅读364次。0. 引言Tensorflow于1.7之后推出了tensorflow hub,其是一个适合于迁移学习的部分,主要通过将tensorflow的训练好的模型进行模块划分,并可以再次加以利用。不过介于推出不久,目前只有图像的分类和文本的分类以及少量其他模型这里先通过几个简单的例子,来展示该hub的使用流程。1. 一个超简单例子1.1 创建一个Module#该文件名为half_plus_two..._tensorflow hub、py

Linux利用重定向三步搞定请求百度主页源代码_linux socket 访问百度-程序员宅基地

文章浏览阅读1.4k次。Linux利用重定向三步搞定请求百度主页源代码第一步:新建文件描述符,简历与百度通信的socket通道exec 8<> /dev/tcp/www.baidu.com/80命令解释:8:新建的文件描述符<>:既要发送请求,又要接收响应数据/dev/tcp:这个目录看不到,但内核确实有一旦执行该命令,就会新建一个socket连接删除文件描述符:..._linux socket 访问百度

C primer plus(第六版) 第七章答案_第七章单元测试提交作业6. 单选题(2分)下图中哪个点是最小方差点?( )。a点cb-程序员宅基地

文章浏览阅读7.1k次,点赞21次,收藏19次。C primer plus(第六版) 第七章答案/* 第一题 */#include<stdio.h>#define SPACE ' 'int main(void){ int count_space = 0; int count_line_break = 0; int count_others = 0; int ch; printf("Please pu..._第七章单元测试提交作业6. 单选题(2分)下图中哪个点是最小方差点?( )。a点cb

Ubuntu:显存占用及处理_ubuntu root图形界面占显存-程序员宅基地

文章浏览阅读2.7k次。问题在进行深度学习时,显存是一种非常宝贵的资源。但是即便在Ubuntu下,各种各样的系统配置都会不自觉的占用一些显存,导致深度学习难以为继。在本博客中,主要搬运一些查询显存占用原因及处理方法。翻译来源链接https://unix.stackexchange.com/questions/591393/how-to-shift-process-from-gpu-to-cpu-usagehttps://askubuntu.com/questions/1220144/can-somebody-explai_ubuntu root图形界面占显存

推荐文章

热门文章

相关标签