php 水平测试,测试您的 PHP 水平的题目_PHP教程

在 Unix Review 上看到这个很有意思的测试,和大家共享。

UnixReview.com

May 2007

Test Your Knowledge of PHP

by Emmett Dulaney

From: http://www.unixreview.com/documents/s=10130/ur0705d/

Increasingly, PHP seems to be the tool/language that is used to make Web sites dynamic. While it is far from the only open source scripting language available, PHP's abilities and features are quickly making it not only a must-have in the Web world but also a topic on many certification exams. Following are fifty questions on PHP at the knowledge level found on beginning/intermediate certification exams. Good luck (answers are at the end of the article)!

1. What is the closing tag used by a PHP-driven web page?

A. />

B. #>

C. ?>

D. .>

2. Which PHP conditional operator means the values are equal AND of the same data type?

A. ==

B. ||

C. ===

D. ==?

3. Which of the following statements is true regarding variables in PHP (choose two)?

A. Variable names in PHP are case sensitive.

B. Variable names in PHP are not case sensitive.

C. PHP variables need to be declared before they can be used.

D. PHP variables do not need to be declared before they can be used.

4. You are evaluating a script written by a previous employee. That script contains a require statement that causes the script to exit when an error occurs. You want to change this so the script will generate a warning when such an error occurs, but keep on running. What should you replace require with?

A. involve

B. need

C. include

D. call_for

5. Which of the following does not represent a comment in a PHP script?

A. // This is a comment

B.

C. # This is a comment

D. /* This is a comment */

6. Which escape character in PHP renders a linefeed?

A. \n

B. \r

C. \t

D. \\

7. What file is used to configure global PHP settings? ______________ (Fill in the blank.)

8. If the value of $AU is currently 7, what is its value as a result of the command $AU++;

A. 8

B. 9

C. 14

D. 49

9. Which printf type specifier is used for a floating point value?

A. d

B. f

C. s

D. u

10. Which PHP logical operator is used to see if both a and b are true?

A. a & b

B. a && b

C. a | b

D. a || b

11. If an array holds 100 entries, which identifier signifies the first entry?

A. 100

B. 99

C. 1

D. 0

12. What function must be called to send the random number generator before array_rand()?

A. limit()

B. scope()

C. srand()

D. hinum()

13. Which two choices below represent the default order resulting from a sort utilizing asort()?

A. A-Z

B. Z-A

C. 0-9

D. 9-0

14. Which of the following is not true for variable names?

A. They can contain an underscore character

B. They can begin with a numeric character

C. They can begin with an alpha character

D. They can contain alphanumeric characters

15. What is the opening tag used on a PHP-driven web page?

A. C. D.

16. What are used to separate blocks of statements within a control structure?

A. brackets [ ]

B. parentheses ( )

C. curly braces { }

D. quotation marks ""

17. Which function can be used to assign a data type to a variable?

A. assign

B. assigntype

C. settype

D. type

18. Which HTTP variable contains the IP address of the machine making a request?

A. ADDR_IP

B. ADDR

C. IP_ADDR

D. REMOTE_ADDR

19. You are creating a simple form for web users to send you a message. Which method should be used with that form?

A. POST

B. GET

C. SEND

D. READ

20. Within your PHP script, you are performing a division operation on two variables. What data type is assigned to the division result, by default, if it is a fractional result?

A. integer

B. double

C. string

D. Boolean

21. Which mode of the fopen() function opens a file for reading or writing, maintains exiting content, and places the file pointer at the beginning of the file?

A. w

B. a

C. r+

D. w+

22. Which function can be used to copy a file?

A. copy()

B. clone()

C. rename()

D. repr()

23. Which of the following is used to set a cookie to expire 24 hours from now?

A. $cookie_expire = time() +24

B. $cookie_expire = time() +1440

C. $cookie_expire = time() +86400

24. Which character is used as a statement terminator to indicate the end of a PHP command?

A. =

B. #

C. |

D. ;

25. Which of the following commands will initialize the $days array?

A. $days = ()

B. $days = array();

C. $days = ""

D. $days = initialize [ ]

E. 12345

F. 12,3,45

G. 1{2,3,4}5

26. What function can be used to see if a file exists?

A. file()

B. file_there()

C. exist_file()

D. file_exists()

27. To create a cookie, your code uses the following entry: SetCookie ("user", "Emmett Dulaney", time() +1800); Which of the following is the best to use to see the value "Emmett Dulaney"?

A. $user

B. $COOKIE[user]

C. $_COOKIE[user]

D. $COOKIE_user

28. Which of the following should be used to combine two or more existing arrays?

A. array_add()

B. array_merge()

C. array_join()

D. array_combine()

29. What function is used to determine whether a session has been started for the current user and then start one if necessary? __________ (Fill in the blank.)

30. After opening a file with the fopen() function, what is used to close the file pointer?

A. fclose()

B. close()

C. die()

D. end()

31. Which of the following functions can be used to show the data type for the $remain variable?

A. echo show($remain);

B. echo gettype($remain);

C. echo type($remain);

D. echo explain($remain);

32. Which of the following functions removes a directory from a file system?

A. rmdir()

B. dir()

C. del()

D. dir_gone()

33. What is the difference between sleep() and usleep()?

A. sleep() suspends operations and usleep() resumes them

B. sleep() accepts seconds and usleep() accepts milliseconds

C. sleep() works for the current process and usleep() works for all processes

D. sleep() can only be specified for the current user and usleep() can be specified for all users

34. You need to know how many elements are in an array. What function should you use to count this?

A. list()

B. count()

C. number()

D. sizeof()

35. Information about a session, by default, is configured in the PHP configuration file to be saved beneath which directory?

A. /var

B. /etc

C. /tmp

D. /usr

36. Which of the following contains variables provided to a script by means of the server environment?

A. $_FILES

B. $_POST

C. $_GET

D. $_ENV

37. Which of the following can be used to delete a file?

A. delete()

B. rid()

C. unlink()

D. close()

38. Which of the following functions can be used to destroy a variable?

A. erase

B. fi

C. remove

D. unset

39. Which mode of the fopen() function opens a file for writing and places the file pointer at the end of the file?

A. w

B. a

C. r+

D. w+

40. Which HTTP variable contains the browser type, and browser version, among other values?

A. BROWSE_AGENT

B. BROWSER_TYPE

C. BROWSER_ENV

D. HTTP_USER_AGENT

41. If the current value of $bsns is 4400, what is the new value as a result of this command: $bsns -= 150;

A. -150

B. 150

C. 4250

D. 4400

E. 4550

F. "4400-150"

42. What are used to enclose conditional expressions?

A. brackets [ ]

B. parentheses ( )

C. curly braces { }

D. quotation marks " "

43. Which PHP data type can be either TRUE or FALSE?

A. Truth

B. Integer

C. Boolean

D. Float

44. Which of the following contains variables provided to a script by means of file uploads?

A. $_FILES

B. $_POST

C. $_GET

D. $_ENV

45. Which constant identifies the highest random number that the system can generate?

A. URAND

B. END_NUMBER

C. ULIMIT

D. RAND_MAX

46. PHP provides support for POSIX through functions of which class?

A. grep

B. ereg

C. psx

D. efgrp

47. From a Boolean standpoint, every zero value in PHP is considered:

A. True

B. False

C. Error

D. Null

48. Which function places results in the opposite order of asort()?

A. arsort()

B. rev()

C. trosa()

D. zsort()

49. Which printf type specifier is used for a string?

A. d

B. f

C. s

D. u

50.Which PHP conditional operator means not equal to?

A. !=

B. =!

C. <=>

D. <>

Answers

1. The closing tag used by PHP is ?>. Answer: C.

2. The PHP conditional operator of three equal signs (===) means the values are equal and of the same data type. Answer: C.

3. PHP variable names are case sensitive and variables do not need to be declared before they can be used. Answer: A and D.

4. The include instruction will create a warning, but allow the script to continue running when an error is encountered. Answer: C.

5. There are at least three ways to create comments in a PHP script, and 6. The \n escape character in PHP renders a linefeed. Answer: A.

7. The global configuration file is php.ini.

8. The command $AU++; increments the variable by one – changing it from 7 to 8. Answer: A.

9. The printf type specifier f is used for a floating point value. Answer: B.

10. The PHP logical operator to use to see if both a and b are true would be a && b. Answer: B.

11. The first entry is 0, the second is 1, and the numbers increment from there. Answer: D.

12. The srand() function must be called to send the random number generator before array_rand(). Answer: C.

13. The default order resulting from a sort utilizing asort() is alphabetic (A-Z) and lowest to highest (0-9). Answer: A and C.

14. Variable names cannot begin with a numeric character. Answer: B.

15. The opening tag used by PHP is

http://www.bkjia.com/PHPjc/318309.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/318309.htmlTechArticle在UnixReview上看到这个很有意思的测试,和大家共享。 UnixReview.com May2007 TestYourKnowledgeofPHP byEmmettDulaney From:http://www.unixreview.com/documents/s=10130...

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/368836.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Django的模板系统

一、模板的组成 html代码和逻辑控制代码 二、逻辑控制代码的形式 1、变量&#xff08;使用双大括号引用变量&#xff09; a、template和context 语法 : {{ var_name }} 模板系统不仅可以传字符串&#xff0c;它可以传递任意对象&#xff0c;对于向列表、字典、元组等对象&…

Java SE 7 Update 25 –发行说明进行了解释。

昨天是CPU日。 Oracle通过6月的Java重要补丁更新发布了Java SE更新25 。 在4月的最后一次重大更新之后&#xff0c;这是与所有其他Oracle产品一起不符合Oracle关键补丁更新计划的最后一个更新。 从2013年10月开始 &#xff0c;Java安全修补程序将遵循四个年度安全发布周期。 但…

springmvc mybatis 做分页sql 语句

<?xml version"1.0" encoding"UTF-8" ?><!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace"ssmy.dao.UserDao"> <res…

LeetCode Subarray Product Less Than K

原题链接在这里&#xff1a;https://leetcode.com/problems/subarray-product-less-than-k/description/ 题目&#xff1a; Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements…

Ansible: hosts文件拆分为inventory和定义inventory全局变量

前言 随着管理机器的增多&#xff0c;我们在使用Ansible的时候时常会遇到hosts文件过于冗长的问题&#xff0c;极其不便于管理&#xff0c;而将hosts文件拆分为inventory就可解决该问题&#xff1b;另外&#xff0c;hosts中的每个主机条目需要指定用户名和私钥或密码&#xff0…

gulp实用配置(1)——demo

在React和Vue推进下&#xff0c;现在很多人都在使用webpack作为自动化构建工具&#xff0c;但其实在很多时候我们并不是一定需要用到它&#xff0c;gulp这样的轻量级构建工具就足够了。 最近一段时间不是太忙&#xff0c;所以就写了三份配置&#xff0c;用在不同的情况下。 这…

使用Maven运行Solr

使用Maven运行Solr Solr是一个开放源代码搜索服务器&#xff0c;它是使用Lucene Core的索引和搜索功能构建的&#xff0c;它可以用于使用几乎任何编程语言来实现可扩展的搜索引擎。 尽管Solr具有许多优点&#xff0c;但建立一个开发环境并不是其中之一。 该博客文章描述了如何…

oracle11g日志原理,oracle11gRAC之log日志体系

oracle11gRAC之log日志体系&#xff1a;1、CRS日志(grid)&#xff1a;首选查看alertlog&#xff1a;$CRS_HOME/grid/log/hostname/alertdbserver1.logClusterware后台进程日志&#xff1a;crsd.Log: $ORA_CRS_HOME/grid/log/hostname/crsd/crsd.Logocssd.Log: $ORA_CRS_HOME/gr…

Eclipse中 如何实现 多行同时编辑

在编辑的时候按下 SHIFT ALT A 之后 鼠标变为 号 选择要同时编辑几行 即可编辑&#xff08;现在eclipse好像只能是编辑一块地方 不能像vs那样 任何地方可以同时编辑 这点很鸡肋&#xff09; 如图 退出编辑 再次 按 SHIFT ALT A 即可 转载于:https://www.cnblogs.com…

AFN\HTTPS\UIWebView

1.AFN使用技巧 1.在开发的时候可以创建一个工具类&#xff0c;继承自我们的AFN中的请求管理者&#xff0c;再控制器中真正发请求的代码使用自己封装的工具类。 2.这样做的优点是以后如果修改了底层依赖的框架&#xff0c;那么我们修改这个工具类就可以了&#xff0c;而不用再一…

检测和删除多余无用的css

本文主要讲解如何检测页面中多余无用的css。 1、chrome浏览器 F12审查元素的Audits 说明&#xff1a;使用Audits&#xff0c;会检测出页面中没有用到的css&#xff0c;需要手动删除多余的css&#xff1b;同时需要说明的是检测出多余无用的css块&#xff0c;而不是某一行css。 …

JDK 8的Calendar.Builder

勇敢的Java新世界的定义特征之一是Java空间中构建器模式的日益普及。 Groovy似乎是JVM上最流行的替代语言&#xff08;对于Java&#xff09;&#xff0c;以在核心库以及Groovy支持的库和框架中大量使用Builder而闻名。 乔希布洛赫与覆盖带来的图案为Java开发者社区心态前列模式…

oracle锁表会话超时时间,ORACLE快速彻底Kill掉的会话,防止锁表

ORACLE快速彻底Kill掉的会话,防止锁表2020-05-30编程之家收集整理的这篇文章主要介绍了ORACLE快速彻底Kill掉的会话,防止锁表&#xff0c;编程之家小编觉得挺不错的&#xff0c;现在分享给大家&#xff0c;也给大家做个参考。万能是sql重启服务&#xff0c;不然&#xff0c;以下…

格式化文本

1.后台获取文本后文本内部存在回车&#xff0c;但是浏览器不能编译\n\t所以使用pre,使文本能够编译文本&#xff0c;2.若文本长度超出预设宽度&#xff0c;可以添加样式&#xff0c;下列代码&#xff0c;可以使超出后的文本自动换行。/*将文本解析为段落,是段落自动化行*/pre {…

webstorm快捷键

Ctrl/ 或 CtrlShift/ 注释&#xff08;// 或者/*…*/ &#xff09; ShiftF6 重构-重命名 CtrlX 删除行 CtrlD 复制行 CtrlG 查找行 CtrlShiftUp/Down 代码向上/下移动。 F2 或ShiftF2 高亮错误或警告快速定位 写代码&#xff0c;按Tab 生成代码 选中文本&#…

vue支付密码

从网上搜索了好多都很麻烦&#xff0c;花了点事件自己做了个&#xff0c;简单轻便&#xff0c;老少皆宜 <template> <section class"pay-mask" click"close_mask" v-show"payshow"> <div class"container"> <div…

打造智能建筑商

构建API时&#xff0c;您应该始终考虑谁将使用它。 当API简单易用时&#xff0c;用户就会感到满意。 当用户满意时&#xff0c;每个人也都会满意。 但是出色的可用性并非总是容易实现的。 有一些模式对此有所帮助&#xff0c;在这篇文章中&#xff0c;我将重点介绍经典的构建器…

结合BeautyEye开源UI框架实现的较美观的Java桌面程序

BeautyJavaSwingRobot 结合BeautyEye开源UI框架实现的较美观的Java桌面程序&#xff0c;主要功能就是图灵机器人和一个2345网站万年历的抓取。。。。   挺简单而且实用的一个项目&#xff0c;实现出来的效果也还不错。希望可以学到知识的小可爱不对应该是帅哥&#xff0c;可…

oracle外表日期,三步教会您掌握oracle外表(external table)

三步教会你掌握oracle外表(external table)外表(externaltable)就像普通的表对像一样&#xff0c;可以select等&#xff0c;只是它是只读的&#xff0c;数据库中只保存了表结构的描述&#xff0c;表数据却没有存放在数据库内&#xff0c;而是存放在了文件系统上。当用户想偶尔使…

【从入门到放弃】23种设计模式(1):设计模式综述

一、设计模式的分类 总体来说设计模式分为三大类&#xff1a; 创建型模式&#xff0c;共五种&#xff1a;工厂方法模式&#xff08;Factory Method&#xff09;、抽象工厂模式&#xff08;Abstract Factory&#xff09;、单例模式&#xff08;Singleton&#xff09;、建造者模式…