0% found this document useful (0 votes)
5 views7 pages

Teste

The document is a technical test for a development course, consisting of 8 multiple choice questions, 1 algorithm implementation, and 1 non-technical question that must be answered in Portuguese. The algorithm implementation accounts for 60% of the total score. It includes questions on programming concepts, data structures, and SQL commands.

Uploaded by

dvddias00
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)
5 views7 pages

Teste

The document is a technical test for a development course, consisting of 8 multiple choice questions, 1 algorithm implementation, and 1 non-technical question that must be answered in Portuguese. The algorithm implementation accounts for 60% of the total score. It includes questions on programming concepts, data structures, and SQL commands.

Uploaded by

dvddias00
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
You are on page 1/ 7

Techni

cal Test
DEV - D
Date: City/State:

Course: Educational Institution: C

Instructions:
This test consists of 8 multiple choice questions, 1 algorithm
implementation and 1 non- technical question. The algorithm is worth
60% of the total score. The non-technical question must be answered in
Portuguese.
You may use any blank space on
this test as a draft. Use the table
below to record your answers.
Good luck!

Answer Sheet
1 2 3 4 5 6 7 8
A
B
C
D

Question 1

1
Given:
1. public class A {
2. public void print(){ System.out.println("x"); } 3.
}
4. public class B extends A {
5. public void print(){ System.out.println("y"); } 6.
}
7. public class Main{
⦁ public static void main(String[] args) {
⦁ B test = new A();
⦁ test.print();
11. }
12. }
What’s the output?
⦁ x
⦁ y
⦁ Runtime or Compilation error on line 9
⦁ Runtime or Compilation error on line 10

Question 2

Given:

2
Consider the following statements:
⦁ Line 18 is not valid because y is protected on A
⦁ Line 19 is not valid because x is private
⦁ Line 20 is valid because m1() is public

⦁ Only I and II are correct


⦁ Only I and III are correct
⦁ Only II and III are correct
⦁ I, II and III are correct

18. z = y;
19. z = a.x;
20. z = a.m1();
21. }
22. }

Question 3

What are the major elements in an object model?

⦁ Abstraction, encapsulation and persistence


⦁ Hierarchy, persistence and typing
⦁ Abstraction, encapsulation and hierarchy
⦁ Hierarchy, concurrency and typing

Question 4

Suppose the keys {1,2,3,4,6,9} are inserted into a hash table with
collisions resolved by chaining. Let the table have 3 slots, and the hash
function be h(k) = k % 3, that is, h(k) returns the remainder of the
Euclidean division of k by 3. How will the keys be organized into this hash
table?

A. 1->4 B. 3->6->9 C. 3->4 D. 1


2->6 1->4 1->6 2->4
3->9 2 2->9 3->6->9

3
Question 5

Consider the following statements:

⦁ A Binary Tree is a tree data structure in which each node has at most two
child nodes, usually distinguished as "left" and "right", and a tree with n
nodes has exactly n−1 branches.
⦁ A Hash Map is a data structure in which, if there’s no collision
among the keys, you can always find an element in O(1) time, even
in the worst case.
⦁ In a doubly linked list data structure, each item is linked to both the
previous and the next items in the list, allowing easy access of list
items backwards as well as forwards.

⦁ Only II and III are correct


⦁ Only II is correct
⦁ Only III is correct
⦁ I, II and III are correct

Question 6

In the following code, assume that Queue is not thread-safe, there is more than
one Producer thread and more than one Consumer thread running and this
program is crashing on runtime. In order to fix the code below how should you
fill in lines (1), (2), (3) and (4)?

Global variables
Queue q;
(1)
Producer thread Consumer thread
runProducer() runConsumer(){ while(true)
{ while(true){ {
item = new item(); (2)
(2) if (q is not empty)
if (q is not full) { item =
{ q.enqueue(item); q.dequeue(); (3)
(3) }
} (4)
(4) }
} }
}

4
⦁ (
1
)
(
2
)
⦁ if(Consumer) sleep(1); else sleep(2);
(
4
)

⦁ (1) mutex m;
(
2
)
⦁ m.lock();
⦁ m.unlock();

⦁ (1) semaphore guard;


(2) wait(guard);
(
3
)
(4) signal(guard);

⦁ Alternatives A, B and C are all correct.

Question 7

Considering the following tables and data information, what would be the
correct result of the SQL command below?

Orders
Number Order_Date cust_id salesperson_id Amount
10 8/2/2010 4 2 540
20 5/6/2012 9 7 150
30 3/12/2012 8 5 1,500
40 1/30/2013 4 8 1,800
50 7/14/2009 9 1 460
60 1/29/2012 7 2 2,400
70 2/3/2012 6 7 600
80 4/1/2013 8 2 2,300
90 3/2/2012 6 7 720

5
A. Abe B. Abe C. Abe D. Bob
Chris Bob Chris Ken
Dan Chris Dan
Dan Joe

Question 8

Given this output on a Linux terminal:

What will be the correct result of the command below?

Infinite
Coins
Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5
cents) and pennies (1 cent), write a method makeChange() to calculate and
return a Set containing the ways of representing n cents using those coins.
Each element of the returned Set should represent the number of coins to
compose the entry value, an array like this: [quarters, dimes,
nickels, pennies].

The method makeChange() can use a Set data structure to store each
representation of n cents, and then, return it. A Set is a collection that contains
no duplicate elements and the order of elements is irrelevant. Consider the
following interface defined for Set:

Method signature Method description


boolean add(Element e) Adds the specified element to this set if it is not already present
(optional operation).

boolean addAll(Set s) Adds all elements from s that are not already present in this set.

boolean contains(Element e) Returns true if this set contains the specified element.

boolean equals(Set s) Compares the specified set s with this set for equality.

Iterator<Element> iterator() Returns an iterator over the elements in this set.

boolean remove(Element e) Removes the specified element from this set if it is present
(optional operation).

int size() Returns the number of elements in this set (its cardinality).

Element[] toArray() Returns an array containing all of the elements in this set.

6
* this is the content of the Set which should be returned by the function.

Your proposed solution can be written in pseudo-code or any well-known


language (C, C++, Java, etc) and you are free to implement any auxiliary
functions. Besides, write down a comment to the implemented function,
explaining how your function will work like the one below.

/**
⦁ The function below will ...
⦁ - Obtain the input
⦁ - Iterate over the elements
⦁ …
⦁ - Print the output and return ...
*/

Algoritm
Solution
Qual a disciplina que você mais gostou de cursar na faculdade e por quê?
(Responder em português)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy