Home Backend Development PHP Tutorial 阿里2016校招研发类笔试题php

阿里2016校招研发类笔试题php

Jun 23, 2016 pm 01:27 PM

一. 选择题 40分钟:
1.某操作系统采用分页存储管理方式,下图给出了进程A和进程B的页表结构。如果物理页的大小为512字节,那么进程A与进程B的物理内存总共使用了__字节。
进程A页表: 进程B页表:
逻辑页 物理页 逻辑页 物理页
0 9 0 1
1 2 1 3
2 4 2 4
3 6 3 7
4 4 2
5 5

4608
3584
4096
5120
2560
2048

2.以下函数中,和其他函数不属于一类的是__。
fwrite
putc
pwrite
putchar
getline
scanf

3.下面线程间的通讯机制中,关键路径上不会产生系统调用从而减少用户态到内核态的上下文切换的是__。
pthread_spin_lock
pthread_mutex
信号量
pthread_rwlock
管道
消息队列

4.使用KMP算法在文本串S中找模式串P是一种常见的方法。假设S=P={xyxyyxxyx},亦即将S对自己进行匹配,匹配过程中正确的next数组是__。
0,1,1,2,2,1,2,2,3
0,1,2,2,3,1,2,2,3
0,1,1,2,3,1,2,2,3
0,1,1,2,3,1,1,2,3
0,1,2,2,3,1,1,2,3
0,1,2,2,2,1,1,2,3

5.两人在一个n个点的无向完全图上进行游戏,每次可以选择当前图中两个端点度数奇偶性相同的边删除,谁不能操作谁输,则在n=1,2,3,……,9,10中,有__个图先手有必胜策略。
2
3
4
5
6
7

6.下面数据结构能够支持随机的插入和删除操作、并具有较好的性能的是__。
数组和链表
链表和哈希表
哈希表和队列
队列和堆栈
堆栈和双向队列
双向队列和数组

7.袋子中分别一叠纸币,其中5元面值的纸币6张,10元面值的纸币5张,20元面值的纸币4张,从袋子中任意取4张纸币,则每种面值至少取到一张的概率为__。
8/91
25/91
48/91
53/91
60/91
63/91

8.一台机器对200个单词进行排序花了200秒(使用冒泡排序),那么花费800秒,大概可以对__单词进行排序。
400
500
600
700
800
900

9.一个英雄基础攻击力为100,携带了三件暴击武器,武器A有40%的概率打出2倍攻击,武器B有20%的概率打出4倍攻击,武器C有10%概率打出6倍攻击,各暴击效果触发是独立事件,但是多个暴击效果在一次攻击中同时触发时只有后面武器的暴击真正生效,例如一次攻击中武器A判定不暴击,武器B和武器C都判定触发暴击,那么这次攻击实际是600攻击力。那么这个英雄攻击力的数学期望是__。
186.6
200
232.8
256.8
320
332.6

10.有一个类B继承自类A,他们数据成员如下:
class A {

private:
int a;
};
class B : public A {

private:
int a;
public:
const int b;
A &c;
static const char* d;
B* e;
}
则构造函数中,成员变量一定要通过初始化列表来初始化的是__。
a b c
b c e
b c d e
c e
b d
b c

11.如果下列的公式成立:78+78=123。则采用的是__进制表示的。
11
12
13
14
15
以上都不对

12.函数f1的定义如下:
void _cdec1 f1(const int& v1, cont int& v2)
{
std::cout std::cout }
则以下代码输出结果为__。
int main (int argc, char* argv[])
{
int i=0;
func (++i,i++);
return 0;
}
0 1
1 2
2 1
2 0
0 2
1 0

13.设一颗二叉树中有3个叶子节点,有8个度为1的节点,则该二叉树中总的节点数为__。
12
13
14
15
16
17

14.在如下8*6的矩阵中,请计算从A移动到B一共有__种走法。要求每次只能向上或向右移动一格,并且不能经过P。

456
492
568
626
680
702

15.有甲、乙、丙三位员工分别负责前端、后端、数据、算法、测试、运维。每人负责两项。已知:
数据和前端住在一起
甲是三人中最年轻的
前端和丙有空一起下棋
后端比算法年长,又比乙年轻
三人中最年长的住得最远
那么,三人分别负责__。
甲-前端&测试;乙-算法&运维;丙-后端&数据
甲-后端&算法;乙-前端&运维;丙-测试&数据
甲-前端&运维;乙-测试&算法;丙-后端&数据
甲-算法&数据;乙-测试&前端;丙-后端&运维
甲-前端&算法;乙-后端&运维;丙-测试&数据
甲-前端&算法;乙-测试&运维;丙-后端&数据

16.在1,2,3,…..1000中,有__个数各位乘积为0。
100
101
172
181
190
191

  1. A为整数数组, N为A的数组长度,请问执行以下代码,最坏情况下的时间复杂度为__。
    void fun(int A[], int n) {
    for (int i = n - 1; i >= 1; i?) {
    for (int j = 0; j if (A[j] > A[j+1]) {
    int tmp = A[j + 1];
    A[j + 1] = A[j];
    A[j] = tmp;
    }
    }
    }
    }
    O(N)
    O(N^2)
    O(Nlog(N))
    O(log(N))
    O(N^3)
    无法确定

  2. 四维空间中有两个夹角60度的向量A和B,随机生成一个向量C分别与A和B计算内积,那么两个内积符号相同的概率为__。
    1/4
    1/3
    1/2
    2/3
    3/4
    以上都不对

  3. 一人以d元在XX买入n套《三体》,d为正整数,其中两套他以成本一半送给朋友,余下的每套高于原价8元卖出,加上送给朋友的两套,如果全部利润是72元,那么n最小可能是__。
    18
    17
    15
    13
    12
    10

  4. 假设基准值为数组首元素的快速排序,要使得数组满足非降序排列,下列数据分布导致快排算法效率最低的是__。
    2-6-3-7-5-1-4
    6-2-3-5-4-1-7
    7-5-3-2-4-1-6
    1-5-7-2-4-6-3
    1-2-3-4-5-6-7
    4-1-3-7-5-6-2

二. 附加大题:

1.在PHP开发过程中,不可避免要处理各种程序错误,你用过哪些PHP函数来跟error打交道呢,请举几个例子并说明其用法。

2.PHP有哪些常用的网络数据抓取方法?

3.mysql的存储引擎有哪些,有什么区别,适用场景?联合索引、前缀索引、覆盖索引的概念,及用sql语句体现三种索引的用法?

4.PHP实现四种基本排序算法(冒泡排序,插入排序,选择排序,快速排序)
$array = array(1,43,54,62,21,66,32,78,36,76,39);

5.如何防止SQL注入?

6.请写出你所熟悉的设计模式,并且写出应用场景以及伪代码(至少3个以上)

版权声明:本文为博主原创文章,未经博主允许不得转载。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

See all articles