Technical Support Basic

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Technical Test

1. Describe what are Model, View, and Controller in MVC.


2. Describe the difference between primary key, unique key and foreign key
in Database Management.
3. Draw a simple database with one2many and many2many relationship
within its tables (We do not need to know all the fields, just the table name
and the important fields).
4. Write a pseudocode of an algorithm of your choice (can be sorting,
search, etc). The more impressive the algorithm the better.
5. Write a pseudocode that loops from 1 to 100, and every time it’s a
multiplication of 3, print "A", if it is a multiplication of 5, print "B", if it is a
multiplication of 15, print "AB". The better your algorithm, the better your
score, and yes there are multiple ways to make this simple algorithm.
6. Assume you are designing a system for a customer who is in
Manufacturing Business. They will need a system where they can
purchase materials from a vendor by the purchasing team, and then store
it in the inventory by the inventory team, and then delivered to the factory
to be manufactured by the manufacturing team, once done manufacturing
team will send it back to the inventory for it to be maintained by the
inventory team.

Design a flowchart for the above scenario, make it as accurate and as


detailed as possible

Answers:

1. The Model-View-Controller (MVC) is a software design pattern that separates


an application into three interconnected components:
• Model: This is the data layer of the application. It’s responsible for
managing the data, logic, and rules of the application. The model
interacts with the database or any other data source to retrieve and
store data.
• View: The view is the presentation layer. It displays the data to the
user and defines how it should be presented. The view is typically
made up of HTML, CSS, and JavaScript that render the user
interface.
• Controller: Acting as an intermediary between the model and the
view, the controller handles user input and interactions. It
processes the input, manipulates data using the model, and selects
a view to render the output

2. Primary Key: A primary key is a column or a set of columns that uniquely


identifies each row in a table. No two rows can have the same primary key value,
and it cannot contain NULL values1.

Unique Key: A unique key is similar to a primary key in that it ensures all values
in a column are different. However, unlike a primary key, a table can have
multiple unique keys, and they can contain NULL values

Foreign Key: A foreign key is a column or a set of columns in one table that
references the primary key columns of another table. The purpose of the foreign
key is to ensure referential integrity of the data. In other words, only values that
are supposed to appear in the database are permitted
3.

Figure 1. One2Many Diagram

Figure 2 Many2Many

4. Algorithm BubbleSort(A)

n = length(A)
repeat
swapped = false
for i = 1 to n-1 inclusive do
if A[i-1] > A[i] then
swap(A[i-1], A[i])
swapped = true
end if
end for
n = n - 1
until not swapped
end Algorithm
A is the array to be sorted.
n is the number of elements in the array.
The repeat-until loop continues until no swaps are needed, which means the
array is sorted.
The for loop goes through each element of the array, comparing it with the next
element and swapping them if necessary.
5. Code Multiply()

for i := 1 to 100 do
switch (i mod 15)
case 0:
print "AB"
case 3:
print "A"
case 5:
print "B"
end switch
end for
End Code

The switch statement checks the remainder of i divided by 15.


If the remainder is 0, it prints “AB”.
If the remainder is 3, it prints “A”.
If the remainder is 5, it prints “B”.
6.

You might also like