TOP 100 PHP JUNIOR Interview Questions
1. What are links?
2. What are the basic operations using links?
3. Name the simple data types supported in PHP.
4. What is increment and decrement, what is the difference between prefix and postfix increment and decrement?
5. What is recursion?
6. What is the difference between =, == and ===?
7. What principles of OOP do you know?
8. What type system is used in PHP? Describe the pros and cons.
9. What is the difference between the keywords: include and require, mysql_connect and mysql_pconnect?
10. What are interfaces? Do you use them? If yes, tell us about it.
11. What is an abstract class and how does it differ from an interface?
12. Can an abstract class contain a private method?
13. What are the visibility modifiers in PHP?
14. What magical methods do you know and how are they used?
15. What are generators and how to use them?
16. What does the yield statement do?
17. What are traits? Alternative solution? Give an example.
18. Describe the behavior when using traits with the same field and/or method names.
19. Will private trait methods be available in the class?
20. Can traits be combined into traits?
21. Tell us about error handling and exceptions (try catch, finaly and throw).
22. What is type hinting, how does it work, why is it needed?
23. What are namespaces and why are they needed?
24. Comparing values of variables in PHP and pitfalls? Cast. What has changed in PHP 8 in this context?
25. How does a session work in PHP, where is it stored, how is it initialized?
26. Superglobal arrays. What do you know? How used?
27. Compare include vs required, include_once vs required_once.
28. What does the complexity of the algorithm mean?
29. What is a closure in PHP? Give an example.
31. What is late binding? Tell us about the behavior and use of static.
32. How to override session storage?
33. Tell us about the SPL library (Reflection, autoload, data structures).
34. Tell us about the principles of SOLID.
35. Tell us about GRASP templates.
36. Tell us about Dependency Injection: what are DI containers? What are the implementation options?
37. What do you know about MVC?
38. What do you know about GoF patterns?
39. What do you know about patterns used in ORM?
40. Write an example implementation of the Singleton pattern in PHP.
41. What is Docker? What is the principle of its work?
42. What is LAMP/NAMP?
43. Tell me about regexp.
44. Tell us about the SSH protocol.
45. What is PDO?
46. What's new in PHP 8?
47. What is PHP PEAR?
48. What versions of PHP are still supported?
49. What is the difference between GET and POST?
50. What is the difference between BREAK and CONTINUE statements?
51. Is there a difference between single and double quotes?
52. What are cookies and why are they used?
53. What cannot be stored in a Cookie and why?
54. What development environment do you prefer and why?
55. Which command to add changes?
56. What is the command to commit changes?
57. What is the command to send changes to a remote repository?
58. What is a transaction?
59. What is normalization?
60. What is denormalization? What is it for?
61. What are the types of links in the database?
62. What does the assertion that the DBMS supports the control of the referential integrity of links mean?
63. If the DBMS you are using does not support cascading deletes to maintain referential integrity of relationships, what can be done to achieve a similar result?
64. What are primary and foreign keys?
65. What is the difference between primary and unique keys?
66. What are the types of JOIN and how do they differ?
67. What are cursors in databases?
68. What are SQL aggregate functions? Give some examples.
69. What are migrations?
70. Talk about a one-to-one, one-to-many, many-to-many relationship.
71. Name and explain any three aggregation methods.
72. Why use the GROUP BY operator?
73. What is the difference between WHERE and HAVING? Give examples.
74. What is the difference between DISTINCT and GROUP BY statements?
75. What are UNION, INTERSECT, EXCEPT operators for?
76. Describe the difference between DATETIME and TIMESTAMP data types.
77. What table engines do you know and how do they differ?
78. What ways to optimize database performance do you know?
79. What is partitioning, replication and sharding?
80. What is the difference between SQL and NoSQL databases?
81. What are NoSQL databases?
82. What data types are there in MySQL?
83. Difference between LEFT JOIN, RIGHT JOIN, INNER JOIN?
84. Difference between JOIN and UNION?
85. What are indices? How do they affect the execution time of SELECT, INSERT?
86. What are stored procedures, functions and triggers in MySQL? What are they for? Give examples of use.
87. How to save nested categories in MySQL?
88. What are the relationships and how are they implemented in Laravel?
89. What are polymorphic relationships, how do they work?
90. What is middleware? Why is this? At what stage is it performed?
91. What is Composer?
92. What is the difference between require and require-dev?
93. Design a database to store information about books and their authors. Write a query to select all authors and the number of books they have written.
94. There is a 3×3 matrix. Count the diagonals, only the even/odd numbers in the diagonals.
95. Your app is throwing a 500 error. Describe the troubleshooting sequence.
96. Write a function to determine if a word is a palindrome.
97. What will be the result of this code:
If (-1) print "True" else print "False"
98. What will be the result of this code:
$a = 3; $b = 2; echo (int) $a / (int) $b;
99. What will be the result of this code:
var_dump(array_merge([2 => 'a'], [3 => 'b']));
100. There is an array of products in random order with manufacturers. Write a method to sort it so that the maximum number of first items meets this criterion: each next item must have a different manufacturer than the previous one.
101. What will $x equal after executing the expression $x = 1 + "1%" + "$1"?
102. There is an array of Integer. Write possible ways to increase each element by one (1).
103. Schematically implement the structure (classes) for the task:
Create an API for posting to Facebook and Google. Google Post URL www.google.com/new-post?text= Google Post URL facebook.com/add-post?message=
106. Write a for loop so that the loop argument changes exponentially.
107. What are the expressions:
print(!! "false") print(!!true) print((int) '125g7') print ((int) 'x52')
108. What is the result of executing a function? How to fix the result?
in_array(1, [0, '0', true])
109. Write a class that implements all possible ways of strong data typing, taking into account the features of PHP 7. 4.
110. Write a method for a many-to-many relationship. In the method, add a condition for the value that is stored in the intermediate table field. For example, there are students and the courses they have enrolled in. The student's enrollment in the course must be confirmed. The confirmation is stored in the intermediate table as is_approve. The students model must have an approvedCourses method.
111. Write a query using the Query Builder model that will match the query:
Select * from `users` where ( 'age'> 21 and ( 'has_education' == 1 or 'work_experience'> 2))
112. Write an artisan command to create the model and migrate it.
113. Write an artisan command to clear the framework cache.