JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
PHP interview questions part 3
PHP interview questions part 3
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the output of the following? x = 2 for i in range(x): x += 1 print (x)
A. Lucy
B. Peter
C. Susan
D. Edmund
Show Correct Answer
Correct Answer is :
Peter
2. What is the output of the following? x = 2 for i in range(x): x -= 2 print (x)
A. Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
B. Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 )
C. Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5 [4] => 5 [5] => 5 )
D. Array ( [0] => 0 [5] => 5 )
Show Correct Answer
Correct Answer is :
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
3. What is the output of the following? for i in range(10): if i == 5: break else: print(i) else: print("Here")
A. Array ( [0] => red [1] => green [2] => blue [3] => yellow )
B. Array ( [0] => blue [1] => yellow [2] => red [3] => green )
C. Array ( [0] => red [1] => green )
D. Array ( [0] => blue [1] => yellow )
Show Correct Answer
Correct Answer is :
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
4. What is the output of the following? for i in range(5): if i == 5: break else: print(i) else: print("Here")
A. Key = Harry, Value = 21
B. Key = Harry, Value = 21
C. Key = Harry, Value = 21
D. Key = Ron, Value = 19
Show Correct Answer
Correct Answer is :
Key = Harry, Value = 21
5. What is the output of the following? x = (i for i in range(3)) for i in x: print(i)
A. I like Volvo BMW and Toyota)
B. I like Volvo, BMW and Toyota)
C. I like Volvo, BMW and Toyota
D. I like. Volvo.,. BMW. and) Toyota)
Show Correct Answer
Correct Answer is :
I like Volvo, BMW and Toyota)
6. What is the output of the following? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i)
A. Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
B. Array ( [peter] => 35 [ben] => 37 [joe] => 43 )
C. Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
D. Array ( [PeTeR] => 35 [BeN] => 37 [Joe] => 43 )
Show Correct Answer
Correct Answer is :
Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
7. What is the output of the following? string = "my name is x" for i in string: print (i, end=", ")
A. Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) )
B. Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] => Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) )
C. Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW ) [2] => Array ( [0] => Toyota [1] => Toyota ) )
D. Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
Show Correct Answer
Correct Answer is :
Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
8. What is the output of the following? string = "my name is x" for i in string.split(): print (i, end=", ")
A. Array ( Peter Ben Joe )
B. Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
C. Array ( 35 37 43 )
D. Array ( “[Peter] => 35” “[Ben] => 37” “[Joe] => 43” )
Show Correct Answer
Correct Answer is :
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
9. What is the output of the following? a = [0, 1, 2, 3] for a[-1] in a: print(a[-1])
A. Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
B. Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
C. Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
D. Array ( [A] => 2 [Cat] => 1 [Dog] => 1)
Show Correct Answer
Correct Answer is :
Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
10. What is the output of the following? a = [0, 1, 2, 3] for a[0] in a: print(a[0])
A. Array ( [d] => yellow )
B. Array ( [c] => blue )
C. Array ( [a] => red )
D. Array ( [e] => yellow )
Show Correct Answer
Correct Answer is :
Array ( [d] => yellow )
11. What is the output of the following? a = [0, 1, 2, 3] i = -2 for i not in a: print(i) i += 1
A. Array ( [3] => blue [4] => blue)
B. Array ( [4] => blue [5] => blue [6] => blue)
C. Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
D. Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
Show Correct Answer
Correct Answer is :
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
12. What is the output of the following? string = "my name is x" for i in ' '.join(string.split()): print (i, end=", ")
A. Array ( [0] => red [1] => green)
B. Array ( [0] => blue [1] => yellow [2] => red [3] => green )
C. Array ( [0] => red [1] => green [2] => blue [3] => yellow )
D. Array ( [0] => blue [1] => yellow )
Show Correct Answer
Correct Answer is :
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
13. The most convenient way to use R is at a graphics workstation running a ________ system.
A. green
B. red
C. blue
D. none of the mentioned
Show Correct Answer
Correct Answer is :
red
14. Which of the following is default prompt for UNIX environment ?
A. Array ( [0] => red [1] => green )
B. Array ( [0] => green [1] => blue )
C. Array ( [0] => red [1] => blue )
D. Array ( [0] => blue [1] => blue )
Show Correct Answer
Correct Answer is :
Array ( [0] => red [1] => green )
15. Which of the following will start the R program ?
A. mango
B. error
C. peach
D. 0
Show Correct Answer
Correct Answer is :
error
16. Which of the following statement is alternative to ?solve
A. sort()
B. asort()
C. rsort()
D. dsort()
Show Correct Answer
Correct Answer is :
rsort()
17. Elementary commands in R consist of either _______ or assignments.
A. Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
B. Array ( [0] => apple [1] => mango [2] => peach [3] => pear )
C. Error
D. Array ( [1] => apple [0] => mango [3] => peach [2] => pear )
Show Correct Answer
Correct Answer is :
Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
18. If a command is not complete at the end of a line, R will give a different prompt, by default it is :
A. Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )
B. Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )
C. Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
D. Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )
Show Correct Answer
Correct Answer is :
Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
19. Command lines entered at the console are limited to about ________ bytes.
A. dsort()
B. casesort()
C. natcasesort()
D. naturalsort()
Show Correct Answer
Correct Answer is :
natcasesort()
20. ._____ text editor provides more general support mechanisms via ESS for working interactively with R.
A. Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
B. Array ( [0] => A [1] => 2 [2] => J [3] => 3 [4] => Q [5] => 4 [6] => K [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
C. Error
D. Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => A [10] => J [11] => Q [12] => K )
Show Correct Answer
Correct Answer is :
Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
Similar Interview Questions
Search for latest jobs
Find Jobs