Docsity

Coding Question instructions, Schemes and Mind Maps of Computer Science

Toggle sidebar
bg1
NAME: _____________________________
DOB: _____________________________
COLLEGE ID: _______________________
COLLEGE : _______________________
BRANCH : ________________________
1 | P a g e
Round 1: Coding Question
Instructions:
1) Understand the coding questions at the start of the session. If you have any questions, you must ask
only the invigilator for clarification.
2) Time Limit: 3 Hours including the evaluation. The start and end time will be communicated by the
invigilator. Manage your time effectively to complete all the questions within the given time frame.
3) Use C or Python for coding. Don't switch between languages during the test.
4) Use of Libraries and External Resources: Unless specified otherwise, avoid using external libraries or
resources beyond what's provided in the standard library of the chosen programming language.
5) Coding Style: Follow good coding practices and maintain a clean and readable code style. Use
meaningful variable names, proper indentation, and comments to explain complex code sections.
6) Function and Variable Naming: Choose descriptive names for functions and variables that accurately
reflect their purpose and usage. Avoid using single-letter variable names unless they are standard
conventions (e.g., i, j, k for loop counters).
7) Input/Output Format: Ensure that your program reads input from stdin or command-line arguments as
specified and outputs results to stdout in the required format. Pay attention to details such as
whitespace, newline characters, and formatting.
8) Error Handling: Implement error handling where necessary, especially for cases where input may be
invalid or unexpected. Handle edge cases gracefully and provide informative error messages if
applicable.
9) Testing: Test your code thoroughly using sample inputs and edge cases to ensure correctness. Check
for off-by-one errors, boundary conditions, and corner cases that might lead to unexpected behaviour.
10) Malpractices: Write your solutions independently without copying code from external sources or
collaborating with others during the test. If found guilty, you will be disqualified.
11) Submission: Submit your solutions within the given time limit. Double-check your code and ensure
that all test cases pass before submitting. Once submitted, you may not be able to make further changes.
12) Electrifex has full discretion to take actions for the smooth conduct and in the evaluation of the coding
round.
pf2

Partial preview of the text

Download Coding Question instructions and more Schemes and Mind Maps Computer Science in PDF only on Docsity!

NAME: _____________________________

DOB: _____________________________

COLLEGE ID: _______________________

COLLEGE : _______________________

BRANCH : ________________________

1 | P a g e

Round 1: Coding Question

Instructions:

  1. Understand the coding questions at the start of the session. If you have any questions, you must ask only the invigilator for clarification.
  2. Time Limit: 3 Hours including the evaluation. The start and end time will be communicated by the invigilator. Manage your time effectively to complete all the questions within the given time frame.
  3. Use C or Python for coding. Don't switch between languages during the test.
  4. Use of Libraries and External Resources: Unless specified otherwise, avoid using external libraries or resources beyond what's provided in the standard library of the chosen programming language.
  5. Coding Style: Follow good coding practices and maintain a clean and readable code style. Use meaningful variable names, proper indentation, and comments to explain complex code sections.
  6. Function and Variable Naming: Choose descriptive names for functions and variables that accurately reflect their purpose and usage. Avoid using single-letter variable names unless they are standard conventions (e.g., i, j, k for loop counters).
  7. Input/Output Format: Ensure that your program reads input from stdin or command-line arguments as specified and outputs results to stdout in the required format. Pay attention to details such as whitespace, newline characters, and formatting.
  8. Error Handling: Implement error handling where necessary, especially for cases where input may be invalid or unexpected. Handle edge cases gracefully and provide informative error messages if applicable.
  9. Testing: Test your code thoroughly using sample inputs and edge cases to ensure correctness. Check for off-by-one errors, boundary conditions, and corner cases that might lead to unexpected behaviour.
  10. Malpractices: Write your solutions independently without copying code from external sources or collaborating with others during the test. If found guilty, you will be disqualified.
  11. Submission: Submit your solutions within the given time limit. Double-check your code and ensure that all test cases pass before submitting. Once submitted, you may not be able to make further changes.
  12. Electrifex has full discretion to take actions for the smooth conduct and in the evaluation of the coding round.

EFX/240301/A

2 | P a g e

QUESTION 1

Given a 2D array, find the maximum sum submatrix in it.

Explanation : The maximum sum submatrix refers to the contiguous submatrix within the given 2D array (or matrix) where the sum of its elements is the highest among all possible submatrices.

SAMPLE INPUT ( Maximum sum sub matrix is highlighted)

1, 2, - 1, - 4, - 20

  • 8, - 3, 4, 8, 1 3, 8, 10, 1, 3
  • 4, - 1, 1, 7, - 6

SAMPLE OUTPUT

35

QUESTION 2

Given are N boards with a length of each given in the form of an array, and K painters, each painter takes 1 unit of time to paint 1 unit of the board. Task: Find the minimum time to paint all boards under the constraints that any painter will only paint continuous sections of boards, say board {2, 3, 4} or only board {1} or nothing but not board {2, 4, 5}.

SAMPLE INPUT 1

N = 4 A = {10, 10, 10, 10} K = 2

SAMPLE OUTPUT 1

20 Explanation : Here we can divide the boards into 2 equal-sized partitions (Painter 1 will paint boards A and A2, and Painter 2 will paint boards A3 and A4). So, each painter gets 20 units of board and the total time taken is 20.

SAMPLE INPUT 2

N = 4 A = {10, 20, 30, 40} K = 2

SAMPLE OUTPUT 2

60 Explanation : Since there are only 2 painters, divide the first 3 boards to painter 1 (A1, A2, and A3) with time = 60, and the last board to painter 2 (A4) with time = 40. Therefore, the total time taken = 60, which is the minimum possible.