0% found this document useful (0 votes)
25 views

SQL TEST - C# (Developer)

1.You have an array (called myArray) with 10 elements (integers in the range 1 to 9). Write a program that prints the number that has the most consecutive occurrences in an array and also prints the number of times it appears in the sequence. The code that populates the array is already written, but you can edit it to try other values. With the refresh button you can recover the original value that will be used to evaluate the question as correct or incorrect during execution.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

SQL TEST - C# (Developer)

1.You have an array (called myArray) with 10 elements (integers in the range 1 to 9). Write a program that prints the number that has the most consecutive occurrences in an array and also prints the number of times it appears in the sequence. The code that populates the array is already written, but you can edit it to try other values. With the refresh button you can recover the original value that will be used to evaluate the question as correct or incorrect during execution.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Calle 113 # 7 – 21 Tower A Floor 15

Teleport Business Park Building


PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

DEVELOPER TECHNICAL TESTS


NAME:
DATE:
START TIME:
END TIME:

THEORETICAL AND PRACTICAL TEST OF C#


1. You have an array (called myArray) with 10 elements (integers in the range 1 to 9).
Write a program that prints the number that has the most consecutive
occurrences in an array and also prints the number of times it appears in the
sequence.

The code that populates the array is already written, but you can edit it to try other
values. With the refresh button you can recover the original value that will be used
to evaluate the question as correct or incorrect during execution.

Your program written in C# must parse the array from left to right so that in case
two numbers meet the condition, the one that appears first from left to right will
be the one that will be printed. The data output for the array in the example
(1,2,2,5,4,6,7,8,8,8) would be as follows:

Longest: 3
Number: 8

In the example, the longest sequence is the number 8 with a sequence of three
eights in a row. Please note that the code you write must print the results exactly
as shown in order for the question to be considered valid.

The code to declare and populate myArray is already there, you can edit it to test
with other values and you can click the update button next to it to return to the
original value that will be used to validate your code during testing.

Answer:
Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

2. Write a program in C# that loops through an array and generates a histogram


based on the numbers in it. The array is called myArray and contains 10 elements
that correspond to integers from 1 to 5. A histogram represents how many times
an element appears in a data set. By
example, for the array: myArray:=(1,2,1,3,3,1,2,1,5,1) the histogram would look like this:
1: *****
2: **
3: **
4:
5: *
The code to declare and populate myArray is already there, you can edit it to test with
other values and you can click the update button next to it to return to the original value
that will be used to validate your code during testing. Make sure the results are printed
exactly as they appear here, as even one missing or extra space can mark the question as
incorrect (Note space between the ":" and the first asterisk).
Answer:
Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

3. We have a 3 x 3 matrix containing numbers from 1 to 9, but this matrix is


simulated using a one-dimensional matrix. So, for example, this matrix:

129
253
515

It would be represented as (1,2,9,2,5,3,5,1,5). The objective is to identify the path


that gives the smallest sum when traversing the two-dimensional array from left to
right. You start in the left column and always move one column to the right of the
same row or one row up or down. In the example, if you start from 1, you can go
to 2 or 5. From there, if you went to 5 you can go to 9 to 3 or 5. On the other hand,
if you go from 1 to 2, from 2 in the middle column you would not be able to go to 5
in the last row in the right column.

You need to find the path that produces the lowest number by adding the values
of each number you visit. So, for the example, the path with the smallest sum
would be 1,2,3

The code to declare and populate myArray is already there, you can edit it to test
with other values and you can click the update button next to it to return to the
original value that will be used to validate your code during testing.

The result of your program should be the 3 numbers you go through to get the
smallest sum separated by a space. For the example, the output would be exactly
like this:
123

Answer:

4. Which of the following instructions converts to a 64-bit integer in C#?


Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

a) Convert.Int
b) Int64.Conversion
c) ToInteger64
d) ToInt64

5. Which of the following is correct regarding dynamic types in C#?

a) ToInt64
b) Type validation is done at runtime
c) The first two are true
d) They are all fake

6. Which of the following data structures does not exist natively in C#?

a) Arrangement
b) Multi-dimensional Array
c) Binary tree
d) stack

7. What class can you use to define a structure that you can access by string index?

a) Collection
b) StringArray
c) DataSet
d) array
e) X Dictionary

8. What is the Using statement used for in C#? Check those that apply.

a) Dictionary
b) Allows you to define which variables are going to be used in a protected method.
c) None of the above.

9. Which of the following instructions obtains the total number of elements of an


array in all its dimensions in C#?

a) Rank
Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

b) TotalLength
c) Length
d) GetLength

10. Which is true for exceptions in C#?

a) Try blocks cannot be nested.


b) There must be one and only one try block per function.

11. If a C# executable file is run many times, multiple processes are spawned. Why
only one of them is executed at a time, what instruction can be used?

a) Mutex
b) Semaphore
c) Critical Section
d) C# Lock

SQL THEORETICAL AND PRACTICAL TEST –

1. The command to update records with SQL is:

a) MODIFY
b) SETTER
c) CHANGE
d) UPDATE
e) INSERT

2. Which of the following statements will delete the record with id equal to 5 from
the employee table?

a) DELETE FROM employee where id=5


b) DROP FROM employee where id=5
c) DROP TABLE employee where id=5
d) TRUNCATE FROM employee where id=5
Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

3. What SQL command is used to create a table?

a) ALTER TABLE
b) NEW TABLE
c) CREATE TABLE
d) ADD TABLE

4. Obtain using an SQL query the first and last name (firstname and lastname) for the
employee with id equal to 3.

Boards:
APPX_employee (id, firstname, lastname, department_id, salary,
educationlevel_id)
APPX_department (id, description, department_city)
APPX_educationlevel (id, description)
Answer:

5. Using an SQL query, obtain the firstname, lastname and salary for employees with
a salary greater than or equal to 50000 and less than or equal to 100000. Show
results sorted by name in ascending order.

Boards:
APPX_employee (id, firstname, lastname, department_id, salary,
educationlevel_id)
APPX_department (id, description, department_city)
Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

APPX_educationlevel (id, description)

Answer:

6. Using an SQL query, obtain the list of departments that have 2 or more employees.
Indicate the name of the department (department_name field) and the number of
employees, ordered by the department name in ascending order.

Boards:
APPX_employee (id, firstname, lastname, department_id, salary,
educationlevel_id)
APPX_department (id, department_name, department_city)
APPX_educationlevel (id, description)

Answer:

7. Obtain, using an SQL query, the list of people and their level of education for
people who work in departments where the sum of the salaries of the employees
who make them up is greater than 250,000. In the list, show the person's last
name (lastname) and the educational level (description of the educationlevel
table). Show results sorted by last name.

Boards:
APPX_employee (id, firstname, lastname, department_id, salary,
educationlevel_id)
APPX_department (id, department_name, department_city)
APPX_educationlevel (id, description)

Answer:
Calle 113 # 7 – 21 Tower A Floor 15
Teleport Business Park Building
PBX 6292529 FAX: 6292529 Ext. 165
Bogotá DC
www.bolsamercantil.com.co

You might also like