0% found this document useful (0 votes)
111 views4 pages

Internal Void: Int Int Int Int Int Int Int Int

The document contains 5 questions related to programming concepts and tasks: 1. Explain HTTP verbs and REST APIs in 3 sentences. 2. Describe the code function that transforms a 1D array into a 2D array in 2 sentences. 3. Create an ERD from an SQL query, discuss LEFT vs INNER JOIN effects, and explain a function in the query. 4. Provide instructions to fill a magic square based on given rules, in any format. 5. Introduce a sales data automation problem, and outline stored procedures to return consolidated sales values.

Uploaded by

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

Internal Void: Int Int Int Int Int Int Int Int

The document contains 5 questions related to programming concepts and tasks: 1. Explain HTTP verbs and REST APIs in 3 sentences. 2. Describe the code function that transforms a 1D array into a 2D array in 2 sentences. 3. Create an ERD from an SQL query, discuss LEFT vs INNER JOIN effects, and explain a function in the query. 4. Provide instructions to fill a magic square based on given rules, in any format. 5. Introduce a sales data automation problem, and outline stored procedures to return consolidated sales values.

Uploaded by

Many Toy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Explain the HTTP Verbs and the correct way to use into a Rest API

2. Explain what the following code does

1. internal static void SingleToMulti(int[] array, int row, int column)


2. {
3. int index = 0;
4. int[,] multi = new int[row, column];
5.
6. for (int y = 0; y < row; y++)
7. {
8. for (int x = 0; x < column; x++)
9. {
10. multi[y, x] = array[index];
11. index++;
12. Console.Write(multi[y, x] + " ");
13. }
14. Console.WriteLine();
15. }
16. }

3.
With the SQL query below:
a. Create an entity relationship diagram to describe the query. It should include entities, its relationships,
primary keys, and data types.
b. What is the result if we change all relations to LEFT JOIN instead of INNER JOIN?
c. In your own words, what is the operation performed by the function F_FUNC?

SELECT sr.SR_ID AS [SR ID],


sr.Requestor_Mail AS [Requestor Email],
sr.Requestor_Name AS [Requestor Name],
(SELECT TOP (1) CONVERT(DATETIME, FieldValue) AS Expr1
FROM dbo.T_TSR_CIC_INFO AS receive_date WITH (NOLOCK)
WHERE (SR_ID = sr.SR_ID)
AND (Field_XName = 'my:fldProcessNewOrder_HPReceivedDate')) AS [HP Receive Date],
inbox.TS_ReceivedExchange AS [Receive Exchange Date],
sr.TS_Created AS [Created Date],
sr.TS_Assigned AS [Assigne Date],
sr.TS_Completed AS [Completed Date],
sr.TS_Closed AS [Closed Date],
do.Name AS [Deal Owner],
sr.SRStatus AS [SR Status],
sr.[Customer Name],
sr.CBC_ID AS Organization,
funct.FunctionDescription AS [Function],
sr.ExpectedDurationHH AS [Expected Duration (hrs)],
sr.TS_TierCommunicated AS [Ack. Communicated Date],
sr.TierCommunicator AS [Ack. Communicator], sr.SRCompletionCommunicator AS [Completion
Communicator],
sr.Country,
sr.Area,
CASE WHEN SR.SRStatus = 'Assigned' THEN 'Not Completed'
WHEN SR.SRStatus = 'Complete' THEN (CASE WHEN CONVERT(DECIMAL(12, 2),
(SR.ExpectedDurationHH) - CONVERT(DECIMAL(12, 2), dbo.F_FUNC ((SELECT TOP (1)
CONVERT(DATETIME, FieldValue) AS Expr1 FROM dbo.T_TSR_CIC_INFO AS receive_date WITH
(NOLOCK) WHERE (SR_ID = SR.SR_ID) AND (Field_XName =
'my:fldProcessNewOrder_HPReceivedDate')), SR.TS_Completed, 'OPC'))) >= 0 THEN 'YES'
ELSE 'NO' END) WHEN SR.SRStatus = 'Cancelled' THEN 'Cancelled'
WHEN SR.SRStatus = 'Closed' THEN (CASE WHEN CONVERT(DECIMAL(12, 2),
(SR.ExpectedDurationHH / 60.00) - CONVERT(DECIMAL(12, 2), dbo.F_FUNC ((SELECT TOP (1)
CONVERT(DATETIME, FieldValue) AS Expr1 FROM dbo.T_TSR_CIC_INFO AS receive_date WITH
(NOLOCK) WHERE (SR_ID = SR.SR_ID) AND (Field_XName =
'my:fldProcessNewOrder_HPReceivedDate')), SR.TS_Closed, 'OPC'))) >= 0 THEN 'YES' ELSE
'NO' END) END AS [SR SLA (Expected duration)]
FROM dbo.T_TSERVICE_REQUEST AS sr WITH (NOLOCK) INNER JOIN dbo.T_USERS AS do WITH
(NOLOCK) ON sr.DealOwnerID = do.NT_User
INNER JOIN dbo.T_FUNCTION AS funct WITH (NOLOCK) ON sr.DealOwnerFunction =
funct.FunctionID
INNER JOIN dbo.T_TR_INBOX AS inbox WITH (NOLOCK) ON sr.InboxID = inbox.Inbox_ID

CREATE Function [dbo].[F_FUNC](


@B DATETIME,
@Y DATETIME
)
returns int
begin
declare @value int
SELECT @value = (DATEDIFF(dd, @B, @Y) + 1)
-(DATEDIFF(wk, @B, @Y) * 2)
-(CASE WHEN DATENAME(dw, @B) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, @Y) = 'Saturday' THEN 1 ELSE 0 END)
Return @value

4.
Magic Square – for this exercise, feel free to use any programming language, or pseudocode, or even
natural language, to resolve the following exercise:
You are given a blank NxN array, N being an odd number. Your purpose is to fill the square per the
following rules:
1. You always start with number 1, and it will always start in the top row and in the middle column
(i.e. if the array is 3x3 number one will start on row 1 and column 2)

2. The next number will be one row up and one column right. If there are no rows above then use
the bottom one, if there are no more columns to the right, use the upmost left one.

2
3. In case that the cell that is next is currently occupied by a previous number, use the cell of the
row that is below

4. Continue filling the square until all cells are filled.

9 1 5

3 4 8

6 7 2
*Remember you are given just size of N.
*You can use any programming language.
5.
Introduction
HP Americas is divided in three regions as follows USA, Canada and BMM (Brazil, Mexico, Multi-
Country Area [MCA]).
For each region, there is a classification for its clients according to its account type:
 Global Account
 Local Account

Due the business complexity, HP has identified a chance to automate one of its processes, to get a reliable
and detailed control of its sales data; in that way, HP is going to have indicators that will help to take
some decisions, based in the sales numbers.

Problem
The Sales Team is focused in the commercialization of Hardware and Software Products, and they also
offer Services. To manage the data, HP desires to know its sales consolidated during the last week, based
in the fact that each vendor can manage more than one account (global or local).
Next table show an example of results for the last week

Bill Hardware Software Services Sales


Person
A 4.000 3.000 500 C1
B 4.000 3.000 100.000 C3
C 100 3.000 0 C2
D 15.000 20.000 4.500 C3
E 12.000 0 0 C3
F 300 0 10.000 C1
G 0 3.000 0 C1
H 0 12.000 1.500 C1
I 0 0 10.000 C3
K 100 100 900 C3
L 22.000 0 22.000 C2

1. Create an E-R Model


2. Create stored procedures (SP) with the parameters that you consider convenient and return the
values according the question
1) How much Hardware and Software was sold for the global Accounts?
2) How much was sold by Region?
3) How much was sold by kind of Product?

You might also like