178 lines
3.3 KiB
Markdown
178 lines
3.3 KiB
Markdown
**Test tasks**
|
||
|
||
** \
|
||
Сollections**
|
||
|
||
You need to write a collection class (which can be used in a foreach construct). The class inherits the iterator interface, that is, it necessarily implements methods:
|
||
|
||
|
||
|
||
* __construct(array $items),
|
||
* prev,
|
||
* next,
|
||
* current,
|
||
* rewind (method rewind returns a pointer to the first element of the collection).
|
||
|
||
Add an array [1,2,3,4,5,6,7,8,9,10] to the collection.
|
||
|
||
In the loop, run through the collection and calculate the sum of the elements.
|
||
|
||
**Students & classes**
|
||
|
||
There are tables:
|
||
|
||
|
||
<table>
|
||
<tr>
|
||
<td>id
|
||
</td>
|
||
<td>First name
|
||
</td>
|
||
<td>Last name
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1
|
||
</td>
|
||
<td>Bob
|
||
</td>
|
||
<td>Biden
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>2
|
||
</td>
|
||
<td>Joey
|
||
</td>
|
||
<td>Johnsen
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>3
|
||
</td>
|
||
<td>Mike
|
||
</td>
|
||
<td>Buffollo
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
|
||
Classes:
|
||
|
||
|
||
<table>
|
||
<tr>
|
||
<td>id
|
||
</td>
|
||
<td>title
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1
|
||
</td>
|
||
<td>A
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>2
|
||
</td>
|
||
<td>B
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
|
||
Students_Classes
|
||
|
||
|
||
<table>
|
||
<tr>
|
||
<td>id
|
||
</td>
|
||
<td>class_id
|
||
</td>
|
||
<td>student_id
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1
|
||
</td>
|
||
<td>1
|
||
</td>
|
||
<td>1
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>2
|
||
</td>
|
||
<td>1
|
||
</td>
|
||
<td>2
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>3
|
||
</td>
|
||
<td>2
|
||
</td>
|
||
<td>3
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
|
||
You need to write a SQL query that displays the id of the class, its name and the number of students in the class, that is:
|
||
|
||
|
||
<table>
|
||
<tr>
|
||
<td>id
|
||
</td>
|
||
<td>title
|
||
</td>
|
||
<td>student_count
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
|
||
|
||
#### **API Development**
|
||
|
||
**Task:** Create a simple REST API endpoint in PHP that returns a JSON response with a list of users from the `users` table.
|
||
|
||
**Additional Test tasks**
|
||
|
||
**Basic Node.js Knowledge**
|
||
|
||
Create a Node.js application that serves a simple webpage. The webpage should display a list of users fetched from a JSON file.
|
||
|
||
**Basic Understanding of Server Software (Apache, Nginx)**
|
||
|
||
Write a basic configuration for an Nginx server with https redirect that serves a PHP application.
|
||
|
||
**Basic Understanding of Linux Servers**
|
||
|
||
This task will assess your fundamental knowledge of Linux server management, including basic command-line operations, file system navigation, user management, and basic network configuration. Give the list of bash commands for each subtask.
|
||
|
||
|
||
### **Task Instructions:**
|
||
|
||
|
||
|
||
1. **Connecting to a Linux Server:**
|
||
* Use SSH to connect to a remote Linux server. Assume the server's IP address is `192.168.1.10` and the SSH port is the default one.
|
||
2. **File System Navigation:**
|
||
* Once connected, navigate to the `/var/log` directory.
|
||
* List all files and directories within `/var/log` and save the output to a file named `log_list.txt` in your home directory.
|
||
3. **User Management:**
|
||
* Create a new user named `testuser` without a home directory.
|
||
4. **File Permissions:**
|
||
* Create a directory named `testdir` in your home directory.
|
||
* Change the permissions of `testdir` to allow read, write, and execute access only to the owner.
|
||
5. **Basic Network Configuration:**
|
||
* Display the current network configuration, including IP addresses and network interfaces.
|
||
6. **Package Management:**
|
||
* Update the package list on the server and install the `curl` package.
|