Example Coding Test Guidelines
Example Coding Test Guidelines
The 'matrix_charm' function takes a string input and creates a matrix where the number of rows is determined by the index of the last even letter, and the number of columns by the index of the last odd letter in the string. The matrix is filled with random values between 10 and 100. If no even or odd letter is found, the respective dimension defaults to 4. For example, with the input 'abEcd', the matrix has 4 rows and 3 columns .
Within the same group of questions, the code is continuous, so a variable created in one question may be used in subsequent questions. It is important to maintain clear and consistent indentation to avoid errors and ensure the continuity of code from one question to another .
The program must continue prompting the user to enter a string until the number of letters in odd alphabet positions equals the number of letters in even positions. Once such a valid string is entered, the program should terminate by printing the string in reverse order. For example, if the user enters 'abab', the program outputs 'baba' .
Students must write their full name, student number, and course clearly on the test. Tests with unreadable names or done anonymously will not be evaluated. The test lasts 2 hours, and the time will be indicated by the professor. If answers are illegible, they will be marked incorrect. All answers must be within the provided document, without using unauthorized paper. No external materials or devices are allowed, and communication among students during the test is prohibited. Any violation results in expulsion and annulment of the test .
The final matrix 'result' is obtained by adding each corresponding entry of matrices m and user_m, then dividing by a calculated denominator. This denominator is derived from the product of the number of even numbers in m and the sum of elements in user_m columns indexed greater than its number of rows. For example, if m and user_m each result in values adding to even numbers sum 6 and row-sum 7, the denominator is 42. Each matrix addition result gets divided by 42 .
Tests that are submitted anonymously or with unreadable student information will not be evaluated, resulting in failure of the test. Additionally, any communication between students during the test, or use of unauthorized materials, leads to the test being annulled for the students involved, and disciplinary measures may be applied .
Students must present their work clearly and legibly, as poorly organized code or handwriting that is difficult to read will result in the answer being marked incorrect. They should ensure that all code and answers are well-formatted and within the designated Answer Area .
In filling the custom matrix, using the 'matrix_charm' function's logic, one must accurately determine the indices of the last odd and even letters from the user's input. These indices dictate the matrix dimensions. When filling these matrices, random values should range between 10 and 100, ensuring that the algorithm adheres to these constraints effectively .
To create a valid user-defined matrix, user_m, it must have the same shape as an existing matrix m. The product of the determinant of user_m and the highest value in its first row should exceed 100. If this condition is not met, the program requests a new matrix. The process involves recalculating the determinant until an acceptable configuration is provided .
The task involves decomposing the string into letters with odd and even alphabetical positions, and ensuring the counts are equal before reversing it. This involves using indexing, conditional checks, and basic string operations for reversal. The efficiency of this operation depends on accurate list management and iteration to verify conditions before executing the reversal logic .