0% found this document useful (0 votes)
9 views12 pages

Example Coding Test Guidelines

This document provides guidelines for a coding test, emphasizing that it is a simplified example and the actual test will be more extensive. It includes instructions for test-taking, such as writing legibly, not using external materials, and the consequences of rule violations. The document also outlines specific coding tasks that will be part of the assessment.

Uploaded by

vkhv12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

Example Coding Test Guidelines

This document provides guidelines for a coding test, emphasizing that it is a simplified example and the actual test will be more extensive. It includes instructions for test-taking, such as writing legibly, not using external materials, and the consequences of rule violations. The document also outlines specific coding tasks that will be part of the assessment.

Uploaded by

vkhv12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Important Guidelines Before You Begin

This document is an example coding test designed to give you a general idea of
what you may encounter in the actual assessment. It is important to
emphasize that this is only a simplified illustration. Please keep in mind:

1. The real coding test contains more questions.

2. The real coding test includes more groups.

3. The real coding test covers a broader range of topics.

4. The real coding test features questions with different levels of difficulty.
Completing this example does not guarantee success in the real test. You
are expected to study all material taught throughout the semester, and not
only the subset of topics that are present in this example test.

Turn the page to view the example coding test.

1
Example Coding Test
Computation I/ Introduction To Programming
December 2025
Version A

Read the following instructions carefully:

1. Write your full name, student number and course at the end of this page in a clear
and readable manner.

2. Anonymous Tests or tests where the student name is not readable will not be evaluated.

3. The coding test has a duration of 2 hours. The ending time of the test will be written
by the professor on the board before the test begins.

4. The mark allocated to each question is indicated within the question.

5. If the professor is unable to read a student’s answer due to poor handwriting or disor-
ganized code, the question will be marked incorrect. It is the student’s responsibility
to present their work clearly and legibly.

6. All answers must be written on the pages of this document. No other paper or do-
cument will be evaluated unless it is previously approved and signed by one of the
professors.

7. No documents (books, notes, etc...) are allowed to be used during the exam (nor
computers, smart watches or phones).

8. Students are not allowed to communicate with one another during the test. Any
suspected exchange of information will result in the exam being annulled for both
students.

9. All phones must be turned off before the beginning of the test. Students are not
allowed to have their phones in their possession even if turned off. Same applies for
smart watches and other digital devices, documents or notes.

10. The breaking of any of the previously mentioned rules will cause for you to be expelled
from the room, invalidating the coding test and the necessary disciplinary measures
will be applied.

Complete Name:

Student number:
Practical class: P

2
Group 1
X points: X point for each question.
Make sure you write your answer inside the designated Answer Area. If
you need to use a Continuation box, pay close attention to indentation and
ensure that your indentation level is clear and consistent. Note that within
the same group, the code is continuous across questions — for example, you
may use in Question 2 a variable that was created in Question 1.

1. (X points) Develop a computer program that repeatedly prompts the user to enter
a string. The program should continue requesting input until the user provides a
string in which the number of letters in odd alphabet positions equals the number
of letters in even alphabet positions. After a valid string is inserted, the program
prints the string reversed. You may determine whether a letter is odd or even based
on its position in the alphabet: for example, A is 1 (odd), B is 2 (even), and so on.
Create a list named letters containing all the letters of the alphabet to use in this
exercise. You may create any auxiliary variables you consider necessary.

For instance, if the user enters the word abab, the program should immediately
output baba. However, if the user enters the word Acre, the program must request
a new string (and continue doing so until a valid string is provided).

Answer Area Question I

3
Answer Area Question I (Continuation)

4
2. (X points) Define a function named matrix_charm. This function takes a string as
input and returns a matrix satisfying the following conditions:
• The number of rows is given by the index of the last even letter in the string.
• The number of columns is given by the index of the last odd letter in the string.
• The matrix should be filled with random values between 10 and 100.
• If either the number of rows or the number of columns cannot be determined
because the string contains no even or no odd letters, then the corresponding
value should default to 4.
An example of the output on console can be found below:
Insert a word: cat
Not good enough... Insert another word: xYz
Not good enough... Insert another word: abEcd
Your word was accepted.

Resulting matrix:
[[73, 41, 98],
[56, 87, 65],
[44, 12, 77],
[83, 55, 19]]
Since the last even letter is ’d’ at index 4, the matrix has 4 rows. Since the last odd
letter is ’c’ at index 3, the matrix has 3 columns.

Answer Area Question II

5
Answer Area Question II (Continuation)

6
3. (X points) Ask the user to enter their favourite word. Then create a matrix, m, by
calling the matrix_charm function and using the user’s favourite word as its input.

Answer Area Question III

7
4. (X points) Create a matrix user_m by asking the user to fill it with integer values of
their choice. The matrix user_m must have the same shape as the previously created
matrix m. The program should not proceed until the user provides a matrix for which
the determinant, multiplied by the highest value in the first row, is greater than 100.

For example, if the user provides the following matrix, the program will say it is
invalid and ask again:
 
2 1
user_m =
3 2

The program continues requesting a new matrix until the user provides a valid one,
such as:
 
50 2
user_m =
1 3

Answer Area Question IV

8
Answer Area Question IV (Continuation)

9
5. (X points) Create a matrix result where each entry is obtained by adding the
values of m and user_m in the corresponding positions, and then dividing this sum
by the number of even numbers in the m matrix multiplied by the sum of all the
elements located in columns whose index is greater than the number of rows in
user_m.

For example,    
4 7 3 8 1 3 2 1
m = 2 9 5 6 user_m = 5 2 3 4
6 1 4 2 4 8 1 2

Even numbers in m: 6
Sum of values in columns with index > 2 in user_m: 7
Denominator: 6 × 7 = 42
 
5 10 5 9
m + user_m =  7 11 8 10
10 9 5 4

5 10 5 9
 
42 42 42 42
7 11 8 10 
result = 
42 42 42 42
10 9 5 4
42 42 42 42

Answer Area Question V

10
Answer Area Question V (Continuation)

11
** EXTRA PAGE **

Good work! ,

12

Common questions

Powered by AI

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 .

You might also like