search
HomeBackend DevelopmentPHP Tutorial阿里2016校招研发类笔试题php

一. 选择题 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
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
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software