Professional Documents
Culture Documents
طالبات-Mid Exam Solutions
طالبات-Mid Exam Solutions
2. In a 3-tier web architecture, which tier is responsible for rendering a web page
a.
server
b.
client
c.
database
d.
none of the above
a.
1
b.
2
c.
3
d.
Array
4. The output of this code is:
$email = "student1@iugaza.edu.ps";
echo ltrim(strstr($email, "@"),"@");
a.
student1
b.
iugaza.edu.ps
c.
student1@iugaza.edu.ps
d.
student1@
a.
echo “\$num”;
b.
echo “$$num”;
c.
echo “/$num”;
d.
echo “$num;”;
6. The break statement ends execution of which of the following
a.
while
b.
for
c.
switch
d.
all of the above
9. Variable can be
a.
long descriptive names
b.
short names
c.
a,b
d.
None of the above
10. What is the function that searches for a specific text in a string
a.
strpos()
b.
strposition()
c.
strrev()
d.
str_replace()
11. PHP is a programming language used for building static Web sites.
Select one:
True
False
a.
int $x=111;
b.
int x=111;
c.
$x = 111;
d.
111=$x;
a.
$_UserName
b.
$18Username
c.
$Username18
d.
$_Username18
15. What the output of this PHP code
$city = "Jerusalem";
$var = $city[2];
echo '$var ';
a.
r
b.
e
c.
error
d.
$var
16. The output of this code is
$Englishalphabet = array ("a", "t", "x");
echo (next($Englishalphabet));
a.
t
b.
x
c.
a
d.
Error
a.
Edit File
b.
Error
c.
Edit File Delete File
d.
Edit File Delete File Save File
18. What is the output for this code?
$nums=array(20,100,350,543,600);
next($nums);
next($nums);
next($nums);
echo current($nums);
a.
600
b.
543
c.
350
d.
Error
19. Array values are keyed by ______ values (called indexed arrays) or using
______ values (called associative arrays).
a.
float, string
b.
even number, string
c.
string, boolean
d.
integer, string
20. Indexed array by default start from
a.
1
b.
0
c.
-1
d.
2
a.
$x = $x
b.
$x = $x+ $x
c.
$x = $x+1
d.
$x = $x+ $x+1
22. What will be the output of the following PHP code
$userAge = array(20, 50, 34, 42);
for($x=0;$x<count($userAge);$x++)
{
if ($userAge [$x] == 50) continue;
echo $userAge[$x];
}
a.
20
b.
203442
c.
3442
d.
50
23. Which one of these functions aren’t a Built-in String functions in PHP
a.
strlen()
b.
str_replace()
c.
strpos()
d.
strreverse()
24. Which function can add value to the end of array
a.
array_unshift()
b.
array_pop()
c.
array_push()
d.
array_shift()
a.
remove whitespaces
b.
remove lowercase alphabet
c.
remove uppercase alphabet
d.
remove underscore
a.
print the array in readable format.
b.
add elements to the beginning of the array and returns the size of array.
c.
verify if a variable is an array and returns TRUE or FALSE
d.
add elements to the end of the array and returns the size of array.
28. function is used to sort an array in ascending order by value while preserving
key associations.
a.
ksort()
b.
asort()
c.
krsort()
d.
usort()
29. In PHP: $myvar =
“2”.“5”;
a.
Integer 7
b.
Integer 25
c.
String 25
d.
Integer (ascii value of character 2 times ascii value of character 5)
30. If $mark = 40 what will be returned when ($mark >= 40) ? "Pass" : "Fail" is
executed?
a.
40
b.
Fail
c.
Error
d.
Pass
31. What the output of this PHP code
print("Islamic"."University"."of"."Gaza");
a.
IslamicUniversityofGaza
b.
Islamic University of Gaza
c.
Nothing
d.
Error
a.
Personal Home Page
b.
Hypertext Preprocessor
c.
Pretext Hypertext Processor
d.
Preprocessor Home Page
33. What the output of the following PHP code
$a = 1;
$b = 2;
$c = 3;
echo ($a % ($b) + $c);
a.
2
b.
3
c.
4
d.
5
a.
single quotes
b.
double quotes
c.
both a and b
d.
None of the above
35. What the output of
var_dump(strpos("Web Development -2- course", "course"));
a.
int(18)
b.
char(20)
c.
int(20)
d.
char(18)