Go Assignment -2

Updated: May 27

Welcome to the second assignment of this Go Tutorial series.

Objectives of the assignment:

  1. To revise the concepts studied till now.

  2. To have a clear understanding of the theory.

  3. Writing a working Go code.

Coding Paradigms:

  1. Use proper comments while writing your code.

  2. Use sensible variable names.

  3. Try to use the concepts studied wherever applicable.

  4. Try to take inputs from the system and not hardcode it.

  5. Always check for corner cases. Your code should run properly for any input.

How do you evaluate your assignment?

  1. Your code should compile without any error.

  2. Test your code for the test case provided in the problems.

If you want a detailed analysis of your solution(code review included), please mail your solution to aman.st.francis@gmail.com with the following details:

  1. Subject: Go Assignment -2 Solution

  2. Body: Write your name and your place of residence.

  3. Attachment: Please make sure that you send a single attachment in a zip folder titled Go_Assignment_2.zip. Place all the solutions in the folder.


  1. Write a program to find the maximum number in an integer array. Test cases: a. Input: [7,0,1,9,4,3] Output: 9

  2. Write a program to transpose a given 2D array. A transpose of an array is when you swap rows and columns. Test cases: a. Input: 1 2 5 5 7 0 9 2 1 Output: 1 5 9 2 7 2 5 0 1

  3. Write a program to sort an integer array in ascending order. Test cases: a. Input: [9,3,1,8,7] Output: [1,3,7,8,9]

  4. Write a program to find a pair with a given sum in it. Test cases: a. Input: Array -> [8,7,2,5,3,1] Sum -> 10 Output: (0,2) or (1,4). Anyone would do.

Please Note: Do not be disheartened if you are not able to solve any problem. We are all here to learn. Send me the best you can do, just do not cheat yourself. If you send me your best work, I could analyse that and come up with its feedback that will help you in the future. If you have any doubts regarding any question, write a mail to me with the subject: Clarification on Assignment-2 and write the problem you have in the mail body.

Looking forward to your solution.



©2020 by Aman Sinha.