PHP/JS/MYSQL 測試題

每題答案在答案兩字下方,白字,拖動鼠標選中顯示,或Ctrl+A


1

<?php
$a = '123';
?>
<?php
echo include "1.php";
?>
答案:

1


2

<?php
    $arr = array(1,2,3);
    foreach($arr as &$val) {
        $val += $val % 2 ? $val++ : $val--;
    }
	$val=10;
    print(join('',$arr));
?>

答案:

3310


3

<?php
ini_set('display_errors',0);
$arr = array(1=>1,3=>3);
$i = 2;
$a = 'test' . isset($arr[$i]) ? $arr[$i] : $i;
var_dump($a);
?>
答案:

NULL


4

<script>  

for(var i = 0;i < 5;i++) {
    setTimeout(function(){
       console.log(i);
    },500);
}
</script> 
答案:

5個5


5

<?php
    print (int)pow(2,69);
?>

答案:

0


6

select a.id,b.name from tab1 as a left join tab2 as b on (a.id=b.id) where a.id >10
若出現空值,使用什麼命令設置默認值
答案:

NVL


7

<?php
    function timesTwo(&$int) {
        $int = $int * 2;
    }
    $int = 2;
    $result = timesTwo($int);
    var_dump($result);
?>
答案:

NULL


8

SELECT * FROM `table` LIMIT 20,10
在上邊sql中使用什麼選項可以使 SELECT FOUND_ROWS() 忽略 LIMIT 子句,返回總數?

答案:

SQL_CALC_FOUND_ROWS




9

<script>  
a();
function a(){alert('hello')}
b();
var  b = function() {alert('world')}
</script> 
輸出什麼
答案:

hello 報錯


10

<?php
   echo intval((0.3+0.6)*10);
  echo intval((0.01+0.57)*100);
  echo intval((0.01+0.09)*10);
?>
答案:
9570


11

Integer i1 = 124;
Integer i2 = 124;
Integer i3 = 129;
Integer i4 = 129;
System.out.println(i1 == i2);
System.out.println(i3.equals(i4));
System.out.println(i3 == i4);
答案:
true true false


12

<?php  
    echo -10%3; 
?>
答案:
-1


13

<?php 
$x = 2; 
echo $x == 2 ? '我' : $x == 1 ? '你' : '它'; 
?> 
答案:


14

<?php  
    $count = 5; 
    function get_count() { 
        static $count = 0; 
        return $count++; 
    } 
    ++$count; 
    get_count(); 
    echo get_count(); 
?>
答案:
1


15

<?php
if($a = 100 && $b = 200) {
    var_dump($a,$b);
}
?>
答案:
bool(true)    int(100)


16
<?php
    $i=11;
    printf("%d",printf("%d",printf("%d",$i)));
?>
答案:
1121

17

<?php
$a = 3;
$b = 5;
if($a = 5 || $b = 7) {
    $a++;
    $b++;
}

echo $a . " " . $b;
?>
答案:
1 6


18

<?php
     $a = count ("567")  + count(null) + count(false);
     echo $a;
?>
答案:
2


19

<script type="text/javascript">
var obj = obj1 = {};
obj1['y'] = 3;
obj['x'] = obj1;
obj1['y'] = 4;
alert(obj['x']['y']);
</script>
答案:
4

20

<script type="text/javascript">

var a ;
var b=null;
var c="s";
var d=123;
var e=function(){};

document.write(typeof  a)
document.write("<br />")
document.write(typeof  b)
document.write("<br />")
document.write(typeof  c)
document.write("<br />")
document.write(typeof  d)
document.write("<br />")
document.write(typeof  e)
</script>
答案:

undefined
object
string
number

function


21

<script type="text/javascript">
if(90<=70<=100){
alert("true")
}
</script>
答案:
true


22

<script type="text/javascript">
for(var count=0;;)
if(count<10)
count+=3;
else
alert(count);
</script>
答案:

12

23

<script type="text/javascript">
function test(number){
return function test(number){
return function test(number){
return number
}}}
alert(test(1)(2)(3))
</script>
答案:

3


發佈了39 篇原創文章 · 獲贊 37 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章