php数据类型

This section contains Aptitude Questions and Answers on PHP Data Types.

本节包含有关PHP数据类型的 Aptitude问题和解答。

1) There are the following statements that are given below, which of them are correct about data types in PHP?

  1. In PHP, variables can store different type of data that is allowed according to PHP data-types.

  2. In PHP, there is no need to use special keywords to specify the data type of variable.

  3. In PHP, we use the 'int' keyword to declare an integer type variable.

  4. We use predefined classes to specify data-types in PHP.

Options:

  1. Only A

  2. Only B

  3. A and B

  4. C and D

Answer & Explanation

Correct answer: 3
A and B

Statements A and B are correct about data-types in PHP.

1)下面给出了以下语句,其中哪些对于PHP中的数据类型是正确的?

  1. 在PHP中,变量可以存储根据PHP数据类型允许的不同类型的数据。

  2. 在PHP中,无需使用特殊关键字来指定变量的数据类型。

  3. 在PHP中,我们使用'int'关键字声明一个整数类型变量。

  4. 我们使用预定义的类来指定PHP中的数据类型。

选项:

  1. 只有一个

  2. 只有B

  3. A和B

  4. C和D

答案与解释

正确答案:3
A和B

语句A和B关于PHP中的数据类型是正确的。

2) There are the following data types that are given below, which of them are supported by PHP?

  1. String

  2. Array

  3. Object

  4. Resource

Options:

  1. A and B

  2. C and D

  3. A, B, and C

  4. A, B, C, and D

Answer & Explanation

Correct answer: 4
A, B, C, and D

All given data-types are supported by PHP.

2)下面提供了以下数据类型,PHP支持哪些数据类型?

  1. 数组

  2. 目的

  3. 资源资源

选项:

  1. A和B

  2. C和D

  3. A,B和C

  4. A,B,C和D

答案与解释

正确答案:4
A,B,C和D

PHP支持所有给定的数据类型。

3) Which of the following is the correct range of integer variable in PHP?

  1. -32768 to 32767

  2. -2,147,483,648 to 2,147,483,647

  3. -128 to 127

  4. None of the above

Answer & Explanation

Correct answer: 2
-2,147,483,648 to 2,147,483,647

In PHP we used 4-bytes integer then its range is from -2,147,483,648 to 2,147,483,647.

3)以下哪个是PHP中整数变量的正确范围?

  1. -32768至32767

  2. -2,147,483,648至2,147,483,647

  3. -128至127

  4. 以上都不是

答案与解释

正确答案:2
-2,147,483,648至2,147,483,647

在PHP中,我们使用4字节整数,则其范围是-2,147,483,648至2,147,483,647。

4) Which of following function is used to return data type of a variable and its value?

  1. get_type()

  2. var_type()

  3. var_dump()

  4. getType()

Answer & Explanation

Correct answer: 3
var_dump()

The var_dump() function returns data-type of a variable and its value.

4)以下哪个函数用于返回变量的数据类型及其值?

  1. get_type()

  2. var_type()

  3. var_dump()

  4. getType()

答案与解释

正确答案:3
var_dump()

var_dump()函数返回变量的数据类型及其值。

5) What is correct output of given code snippets in PHP?

<?php
$num = 256;
var_dump(num);
?>

  1. int(256)

  2. integer(256)

  3. string(3) "num"

  4. None of the above

Answer & Explanation

Correct answer: 3
string(3) "num"

The above code will print a string(3) "num" on the webpage because we did not use the $ symbol with variable name in var_dump() function.

5)PHP中给定代码段的正确输出是什么?

  1. 整数(256)

  2. 整数(256)

  3. string(3)“ num”

  4. 以上都不是

答案与解释

正确答案:3
string(3)“ num”

上面的代码将在网页上打印一个string(3)“ num” ,因为在var_dump()函数中我们没有在变量名中使用$符号。

6) What is correct output of given code snippets in PHP?

<?php
$num = 256;
var_dump($num);
?>

  1. int(256)

  2. integer(256)

  3. string(3) "num"

  4. None of the above

Answer & Explanation

Correct answer: 1
int(256)

The above code will print "int(256)" on the web page.

6)PHP中给定代码段的正确输出是什么?

  1. 整数(256)

  2. 整数(256)

  3. string(3)“ num”

  4. 以上都不是

答案与解释

正确答案:1
整数(256)

上面的代码将在网页上打印“ int(256)”

7) What is correct output of given code snippets in PHP?

<?php
$num = 256;
$num1 = var_dump($num);
echo "num1 is ".$num1;
?>

  1. int(256) num1 is int(256)

  2. int(256) num1 is

  3. Syntax error

  4. None of the above

Answer & Explanation

Correct answer: 2
int(256) num1 is

The above code will print "int(256) num1 is" on the webpage.

7)PHP中给定代码段的正确输出是什么?

  1. int(256)num1是int(256)

  2. int(256)num1是

  3. 语法错误

  4. 以上都不是

答案与解释

正确答案:2
int(256)num1是

上面的代码将在网页上打印“ int(256)num1 is”

8) What is correct output of given code snippets in PHP?

<?php
$num = "Hello";
var_dump($num);
?>

  1. string(hello)

  2. string("hello")

  3. string(5) "hello"

  4. None of the above

Answer & Explanation

Correct answer: 3
string(5) "hello"

The above code will print [string(5) "hello"] on the web page.

8)PHP中给定代码段的正确输出是什么?

  1. 字符串(你好)

  2. 字符串(“ hello”)

  3. string(5)“你好”

  4. 以上都不是

答案与解释

正确答案:3
string(5)“你好”

上面的代码将在网页上打印[string(5)“ hello”]。

9) What is correct output of given code snippets in PHP?

<?php
$num = 256;
var_dump($num);
$num = "Hello";
var_dump($num);
?>

  1. int(256)

  2. int(256) string(5) "Hello"

  3. int(256) string(3)

  4. syntax error

Answer & Explanation

Correct answer: 2
int(256) string(5) "Hello"

The above code will print [int(256) string(5) "Hello"] on the web page.

9)PHP中给定代码段的正确输出是什么?

  1. 整数(256)

  2. int(256)字符串(5)“你好”

  3. int(256)字符串(3)

  4. 语法错误

答案与解释

正确答案:2
int(256)字符串(5)“你好”

上面的代码将在网页上打印[int(256)string(5)“ Hello”]。

10) What is correct output of given code snippets in PHP?

<?php
$num = true;
var_dump($num);
?>

  1. bool(true)

  2. boolean(true)

  3. bool(4) "true"

  4. boolean(4) "true"

Answer & Explanation

Correct answer: 1
bool(true)

The above code will print "bool(true)" on the web page.

10)PHP中给定代码段的正确输出是什么?

  1. 布尔值(true)

  2. 布尔值(true)

  3. bool(4)“真”

  4. boolean(4)“ true”

答案与解释

正确答案:1
布尔值(true)

上面的代码将在网页上打印“ bool(true)”。

11) What is correct output of given code snippets in PHP?

<?php
$usrArray = array("ABC","PQR","XYZ");
var_dump($usrArray);
?>

  1. array(3) string

  2. array(3) { [0]=> string(3) "ABC" [1]=> string(3) "PQR" [2]=> string(3) "XYZ" }

  3. Syntax error

  4. None of the above

Answer & Explanation

Correct answer: 2
array(3) { [0]=> string(3) "ABC" [1]=> string(3) "PQR" [2]=> string(3) "XYZ" }

11)PHP中给定代码段的正确输出是什么?

  1. array(3)字符串

  2. array(3){[0] =>字符串(3)“ ABC” [1] =>字符串(3)“ PQR” [2] =>字符串(3)“ XYZ”}

  3. 语法错误

  4. 以上都不是

答案与解释

正确答案:2
array(3){[0] =>字符串(3)“ ABC” [1] =>字符串(3)“ PQR” [2] =>字符串(3)“ XYZ”}

12) What is correct output of given code snippets in PHP?

<?php
$usrArray = array("ABC",786,"XYZ");
var_dump($usrArray);
?>

  1. array(3) { [0]=> string(3) "ABC" [1]=> string(3) 786 [2]=> string(3) "XYZ" }

  2. array(3) { [0]=> string(3) "ABC" [1]=> int(786) [2]=> string(3) "XYZ" }

  3. Syntax error

  4. None of the above

Answer & Explanation

Correct answer: 2
array(3) { [0]=> string(3) "ABC" [1]=> int(786) [2]=> string(3) "XYZ" }

12)PHP中给定代码段的正确输出是什么?

  1. array(3){[0] =>字符串(3)“ ABC” [1] =>字符串(3)786 [2] =>字符串(3)“ XYZ”}

  2. array(3){[0] =>字符串(3)“ ABC” [1] => int(786)[2] =>字符串(3)“ XYZ”}

  3. 语法错误

  4. 以上都不是

答案与解释

正确答案:2
array(3){[0] =>字符串(3)“ ABC” [1] => int(786)[2] =>字符串(3)“ XYZ”}

13) In PHP, NULL is a data type?

  1. Yes

  2. No

Answer & Explanation

Correct answer: 1
Yes

In PHP, NULL is also data-type which can have only one value null.

13)在PHP中,NULL是数据类型吗?

  1. 没有

答案与解释

正确答案:1

在PHP中,NULL也是数据类型,只能有一个值null。

14) What is correct output of given code snippets in PHP?

<?php
$x = null;
var_dump($x);
?>

  1. NULL

  2. NULL(4)

  3. NULL(null)

  4. None of the above

Answer & Explanation

Correct answer: 1
NULL

The above code will print NULL on the webpage.

14)PHP中给定代码段的正确输出是什么?

  1. 空值

  2. 空(4)

  3. NULL(空)

  4. 以上都不是

答案与解释

正确答案:1
空值

上面的代码将在网页上显示NULL。

15) Can we create a user-defined class in the PHP script?

  1. Yes

  2. No

Answer & Explanation

Correct answer: 1
Yes

Yes, we can create a user-defined class in the PHP script.

15)我们可以在PHP脚本中创建用户定义的类吗?

  1. 没有

答案与解释

正确答案:1

是的,我们可以在PHP脚本中创建一个用户定义的类。

16) There are the following statements that are given below, which of them are correct about resource type in PHP?

  1. The resource type is used to contain the reference to the function.

  2. The resource type is used to store the reference of external resources.

  3. The resource type is used for the database call.

  4. None of the above

Options:

  1. A and B

  2. B and C

  3. A, B, and C

  4. D

Answer & Explanation

Correct answer: 3
A, B, and C

Statements A, B, and C are correct about resource type in PHP.

16)下面给出了以下语句,其中哪些对PHP中的资源类型是正确的?

  1. 资源类型用于包含对该函数的引用。

  2. 资源类型用于存储外部资源的引用。

  3. 资源类型用于数据库调用。

  4. 以上都不是

选项:

  1. A和B

  2. B和C

  3. A,B和C

  4. d

答案与解释

正确答案:3
A,B和C

关于PHP中的资源类型,语句A,B和C是正确的。

17) What is the correct output of given code snippets in PHP?

<?php
class Sample
{function Sample()
{$Var1 = "India";
}
}
// create an object of Sample class
$obj = new Sample();
echo $obj->$Var1;
?>

  1. India

  2. Error

Answer & Explanation

Correct answer: 2
Error

The above code will generate an error because $Var1 is not a member of the Sample class.

17)PHP中给定代码段的正确输出是什么?

  1. 印度

  2. 错误

答案与解释

正确答案:2
错误

上面的代码将产生错误,因为$ Var1不是Sample类的成员。

18) What is the correct output of given code snippets in PHP?

<?php
class Sample
{function Sample()
{$this->$Var1 = "India";
}
}
// create an object of Sample class
$obj = new Sample();
echo $obj->$Var1;
?>

  1. India

  2. Error

Answer & Explanation

Correct answer: 1
India

The above code will generate print "India" on the web page.

18)PHP中给定代码段的正确输出是什么?

  1. 印度

  2. 错误

答案与解释

正确答案:1
印度

上面的代码将在网页上生成打印“印度”。

19) What is the correct output of given code snippets in PHP?

<?php
class Sample
{function Sample()
{$this->$Var2 = "Australia";
$this->$Var1 = "India";
}
}
// create an object of Sample class
$obj = new Sample();
var_dump($obj);
?>

  1. object(Sample)#1 (1) { [""]=> string(5) "India" }

  2. object(Sample)#1 (2) { [""]=> string(5) "Australia" }

  3. Error

  4. None of the above

Answer & Explanation

Correct answer: 1
object(Sample)#1 (1) { [""]=> string(5) "India" }

19)PHP中给定代码段的正确输出是什么?

  1. object(Sample)#1(1){[“”] => string(5)“ India”}

  2. object(Sample)#1(2){[“”] => string(5)“ Australia”}

  3. 错误

  4. 以上都不是

答案与解释

正确答案:1
object(Sample)#1(1){[“”] => string(5)“ India”}

翻译自: https://www.includehelp.com/php/data-types-aptitude-questions-and-answers.aspx

php数据类型

php数据类型_PHP数据类型能力问题和解答相关推荐

  1. c语言编程输入a是输出为a_C ++编程基本输入,输出,数据类型,声明能力倾向问题和解答...

    c语言编程输入a是输出为a This section contains C++ programming Basic Input, Output, Data types, Declaration etc ...

  2. php变量类型怎么表示,PHP 数据类型_php

    php支持8种原始数据类型. 四种标量类型: ? boolean(布尔型) ? integer(整型) ? float(浮点型,也称作 double) http://www.gaodaima.com/ ...

  3. php泡点,PHP数据类型_PHP教程_编程技术

    两相篓儿狗盗棉袄崇兴猛药.馆际麦垅蓝带柔情失密泡点前因信使!小孩女监连山麦道抽筋魔神煤窑,不收莽撞库格祖逖拼版!明艳路单板坯瓯绣供养哩数!轻吹梅树爽利轻贱抛洒年鉴插曲蒙医:北城湿病国税漫坡侧板钳子面嫩 ...

  4. iOS有哪些数据类型/基本数据类型?

    简述 本文主要探究使用OC作为iOS开发语言时,我们能使用哪些数据类型. 一切类型始于C. C语言的类型 基本数据类型: 基本数据类型(fundamental data types)也叫原始数据类型( ...

  5. python numpy 数据类型为python对象-python numPy模块 与numpy里的数据类型、数据类型对象dtype...

    学习链接:http://www.runoob.com/numpy/numpy-tutorial.html 简介: numPy是python语言的一个扩展库,是一个运行非常快的数学库,主要用于数组计算. ...

  6. R语言数据类型及数据类型判断

    R语言数据类型及数据类型判断 目录 R语言数据类型及数据类型判断 从存储角度看R数据类型

  7. 【C 语言】数据类型本质 ( 数据类型 | 数据类型本质 | 数组地址 | 数组首元素地址 )

    文章目录 一.数据类型 二.数据类型本质 ( 数组地址 | 数组首元素地址 ) 一.数据类型 " 数据类型 " 是 数据的抽象 ; 相同类型的数据 , 表示形式相同 , 存储格式相 ...

  8. 【Flutter】Dart 数据类型 ( dynamic 数据类型 )

    文章目录 一. dynamic 数据类型 二. dynamic 变量无法进行语法检查 三. dynamic 变量运行时类型修改 四. 完整代码示例 五. 相关资源 Dart 语言中有 dynamic ...

  9. html js 添加数据类型,js数据类型判断和转换

    8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? 前言 无论笔试还是面试,总会问到数据类型和隐式转换.今天彻底整理一下这块的知识,希望对大家有帮助. 看到下面的题,是不是 ...

最新文章

  1. 一些有用的资源分享(工具+电子书)
  2. MySQL SQL的概述
  3. mysql数据库的环境搭建_数据库学习(一)MySql环境搭建
  4. 【转】Linux系统编程---dup和dup2详解
  5. Android编译工具Freeline的使用
  6. C++_异常6-其他异常特性
  7. 具有InlfuxDB的Spring Boot和Micrometer第2部分:添加InfluxDB
  8. 计算机课实验三,成都信息工程学院计算机网络课程实验三
  9. spring学习(13):使用junit4进行单元测试续
  10. 十二、Promise的学习笔记(Promise的基本使用、链式编程、all())
  11. python三种基本的数据类型有_python基本数据类型一
  12. 疫情趋势下,远程控制软件成为刚需,ToDesk or 向日葵,哪一款最好用?
  13. C++句柄类 [ 资深博主 ]
  14. 基于机器学习的文本情感分类
  15. scrapy 使用无忧代理IP 需要填写无忧代理IP提供的API订单号(请到用户中心获取) 这个是要钱吗??...
  16. k8s java供应链项目篇
  17. 天载杠杆炒股A股三大指数团体高开
  18. 易大师接口自动化测试平台如何创建不同协议的接口并进行测试
  19. ESP8266 (WEMOS D1 R1 ) + L9110S_FOUR 驱动直流电机
  20. 记录一下家里双路由实现wifi漫游功能

热门文章

  1. java emoji显示乱码_Java 解决Emoji表情过滤问题
  2. 清北学堂培训2019.4.4
  3. 正则表达式知识详解(转自晴天碧日)
  4. 分块编码(Transfer-Encoding: chunked)VS Content-length
  5. Oracle .事物,提交,回滚
  6. 《Linus Torvalds自传》摘录
  7. Oracle 创建表空间,用户,赋值(简装)
  8. 固有属性与自定义属性
  9. gitlab的用户使用手册
  10. SQL Server 开发指南(经典教程)