Contents
Contents
Background ... 2
Background ... 2
General algorithm for interacting with CodeVita Platform ... 2
General algorithm for interacting with CodeVita Platform ... 2
Common Mistakes ... 3
Common Mistakes ... 3
1. 1. Compile-TimCompile-Time e Errors Errors ... ... 33 2. 2. Run-time Run-time Errors Errors ... ... 33 3. 3. Wrong Wrong Answer Answer ... ... 44 Do’s and Don’t Do’s and Don’ts ... 4s ... 4
Do’s Do’s... 4... 4 Don’ts Don’ts... 4... 4 Closing Comments ... 5 Closing Comments ... 5
Common Mistakes in using CodeVita Code Evaluation Platform:
Common Mistakes in using CodeVita Code Evaluation Platform:
What the participants should and should not do?
What the participants should and should not do?
Background
Background
CodeVita code evaluation platform performs automated evaluation of code submitted by participants. CodeVita code evaluation platform performs automated evaluation of code submitted by participants. There is zero manual intervention. No human user reads the code submitted by the participants. The There is zero manual intervention. No human user reads the code submitted by the participants. The evaluation is similar to how objective questions are evaluated in competitive exams. For e.g. a evaluation is similar to how objective questions are evaluated in competitive exams. For e.g. a competitive exam answer sheet is typically read by OCR (Optical Character Recognition) technology. The competitive exam answer sheet is typically read by OCR (Optical Character Recognition) technology. The software reads the answers marked by the examinee and grades whether the answer is correct or software reads the answers marked by the examinee and grades whether the answer is correct or incorrect. Such a technology serves two
incorrect. Such a technology serves two purposes,purposes, 1.
1. It prevents any subjective biases / human errors that human users correcting the papers wouldIt prevents any subjective biases / human errors that human users correcting the papers would bring.
bring. 2.
2. The amount of time it will take for humans to evaluate will never make it possible to declareThe amount of time it will take for humans to evaluate will never make it possible to declare results in a short time. Sheer volumes make it mandatory that the correction process is results in a short time. Sheer volumes make it mandatory that the correction process is automated.
automated.
For CodeVita, TCS follows a similar methodology. The evaluation of code is automatic. No human is For CodeVita, TCS follows a similar methodology. The evaluation of code is automatic. No human is involved in code evaluation. Hence it is of paramount importance that participants of CodeVita adhere involved in code evaluation. Hence it is of paramount importance that participants of CodeVita adhere to the input / output specifications mentioned with each question.
to the input / output specifications mentioned with each question. If your input or output formatsIf your input or output formats don’t adhere to the specifications, the system will grade it
don’t adhere to the specifications, the system will grade it as an incorrect submission.as an incorrect submission.
General algorithm for interacting with CodeVita Platform
General algorithm for interacting with CodeVita Platform
1.
1. Ensure that your compilers match the following specificationsEnsure that your compilers match the following specifications 2.
2. Ensure that your programming environment is setup on the machine(s) you are using. There isEnsure that your programming environment is setup on the machine(s) you are using. There is no provision in the CodeVita Platform website to allow users to write the programs. Write your no provision in the CodeVita Platform website to allow users to write the programs. Write your programs in your favourite IDE, use a debugger/ profiler or other tools that you may need, on programs in your favourite IDE, use a debugger/ profiler or other tools that you may need, on your own machines. Once the code is completed, save your program as per extensions. You can your own machines. Once the code is completed, save your program as per extensions. You can submit your solutions in any of the 7 allowed languages. You are free to submit even multiple submit your solutions in any of the 7 allowed languages. You are free to submit even multiple language solutions for the same problem. For e.g. a team may decide that two people will work language solutions for the same problem. For e.g. a team may decide that two people will work on the same problem. If these people have different skill-sets they can write solutions in on the same problem. If these people have different skill-sets they can write solutions in
different languages and submit. So let’s say member1 writes a program in C and member2 different languages and submit. So let’s say member1 writes a program in C and member2
writes it in
writes it in Java. Both programs can be Java. Both programs can be submitted. submitted. Submit only the Submit only the source code.source code. 3.
3. All the source code needs to be written in one file itself. Do not split your program in multipleAll the source code needs to be written in one file itself. Do not split your program in multiple files. If you are programming in Java / C++ / C#
files. If you are programming in Java / C++ / C#do notdo notpackage them in packages or package them in packages or namespacesnamespaces 4.
4. As you are already aware, each team member As you are already aware, each team member needs to login with their credentials needs to login with their credentials (Ref #, Email(Ref #, Email ID and Secret Code)
Common Mistakes
Common Mistakes
1.
1.
Compile-Time Errors
Compile-Time Errors
You will get compile time errors inYou will get compile time errors in the following conditionsthe following conditions
CodeVita platform treats warnings as errors. If your compiler gives you a warning, the CodeVitaCodeVita platform treats warnings as errors. If your compiler gives you a warning, the CodeVita
platform will treat it as an error and you
platform will treat it as an error and you will get the message “Compilewill get the message “Compile--Time Error” as status forTime Error” as status for
your submission your submission
o
o Common examples of this includeCommon examples of this include – –using a deprecated API in Java or main function in Cusing a deprecated API in Java or main function in C
does not return an int. does not return an int.
o
o In short, after compilationIn short, after compilation – – your compiler should give no output after compiling youryour compiler should give no output after compiling your
program. Submit your program only once you have ensured this. The following program. Submit your program only once you have ensured this. The following commands are used for compiling programs at the CodeVita end.
commands are used for compiling programs at the CodeVita end.
o o
gcc
gcc – –WallWall – –lm $yourfilelm $yourfile g++ -Wall
g++ -Wall – –lm $yourfilelm $yourfile javac
javac – –Xlint $yourfileXlint $yourfile mcs $yourfile
mcs $yourfile
If you are using a compiler different from the ones specified, it is your obligation to see If you are using a compiler different from the ones specified, it is your obligation to see to it the output matches the ones from specified compilers.
to it the output matches the ones from specified compilers.
Using invalid APIs thatUsing invalid APIs that don’t work in gccdon’t work in gcc / g++ / jdk1.6 / .Net Framework 4.0 compilers, will/ g++ / jdk1.6 / .Net Framework 4.0 compilers, will
result in compilation errors. For e.g. using functions from conio.h will for C language will result in result in compilation errors. For e.g. using functions from conio.h will for C language will result in compilation errors because conio.h does not exist in gcc.
compilation errors because conio.h does not exist in gcc.
2.
2.
Run-time Errors
Run-time Errors
You will get run-time errors in the following circumstances You will get run-time errors in the following circumstances
Once your program is compiled by CodeVita platform after submission, it runs a battery of testOnce your program is compiled by CodeVita platform after submission, it runs a battery of test
cases against your program. These test cases will provide inputs to your programs and capture cases against your program. These test cases will provide inputs to your programs and capture output from your program. If your program fails to handle the input properly, then it will lead in output from your program. If your program fails to handle the input properly, then it will lead in a run-time error. For e.g. you may have submitted a code to add to matrices of 3x3, but the test a run-time error. For e.g. you may have submitted a code to add to matrices of 3x3, but the test case may contain a matrix of any size. If your program fails to handle this constraint, your case may contain a matrix of any size. If your program fails to handle this constraint, your program will fail with a run-time error.
program will fail with a run-time error.
Failing to handle inputs correctly will result in run-time errors. For e.g. when your program isFailing to handle inputs correctly will result in run-time errors. For e.g. when your program is
asked to read from a file whose path is provided as an input to your program, not having a asked to read from a file whose path is provided as an input to your program, not having a mechanism to accept the file path as input or hard-coding a file name
mechanism to accept the file path as input or hard-coding a file name in your program will resultin your program will result in a run-time error.
3.
3.
Wrong Answer
Wrong Answer
When the status of your submission is marked as a Wrong Answer, one or more of the following is true When the status of your submission is marked as a Wrong Answer, one or more of the following is true
Input handling mechanism of your program is wrongInput handling mechanism of your program is wrong
Output specifications are not adhered toOutput specifications are not adhered to
Program logic is incorrect and fails one or more test casesProgram logic is incorrect and fails one or more test cases
Let’s see some examples Let’s see some examples
Incorrect input handlingIncorrect input handling – –If for Simple Interest Calculations if value of If for Simple Interest Calculations if value of Principle, Rate or TenurePrinciple, Rate or Tenure
is negative, then the p
is negative, then the program should output “Invalid Input”. Instead, if somebody actuallyrogram should output “Invalid Input”. Instead, if somebody actually calculates and outputs negative simple interest, then the program will receive “Wrong Answer” calculates and outputs negative simple interest, then the program will receive “Wrong Answer”
status message. status message.
Incorrect output handlingIncorrect output handling – – If the output specification mentions that simple interest should beIf the output specification mentions that simple interest should be
output as “Simple Interest : <NN>”, then, changing format of the required output such as output as “Simple Interest : <NN>”, then, changing format of the required output such as “Simple Interest is
“Simple Interest is -- <NN>” will result in Wrong Answer. Any deviation from expected output, in<NN>” will result in Wrong Answer. Any deviation from expected output, in
general, will be marked as wrong answer. Please read the output specification carefully so that general, will be marked as wrong answer. Please read the output specification carefully so that such silly mistakes do not
such silly mistakes do not happen.happen.
Incorrect program logicIncorrect program logic – –If your program fails to correctly calculate the value of simple interestIf your program fails to correctly calculate the value of simple interest
for a valid input in terms of Principle, Rate or Tenure, then the program will
for a valid input in terms of Principle, Rate or Tenure, then the program will receive “Wrongreceive “Wrong Answer” status message.
Answer” status message.
Do’s and Don’ts
Do’s and Don’ts
Do’s
Do’s
1.1. Maintain cool and calm when solving the problems.Maintain cool and calm when solving the problems. 2.
2. Have an open mindHave an open mind – – When the system gives a particular status message to your submission,When the system gives a particular status message to your submission, analyze why you get that status message. If you think deep enough you will be able to figure out analyze why you get that status message. If you think deep enough you will be able to figure out your mistakes.
your mistakes.
Don’ts
Don’ts
1.
1. Do not post angry questions or rant about “my solution is right, why is it marked wrong”Do not post angry questions or rant about “my solution is right, why is it marked wrong”
messages. The questions and the solutions are thoroughly researched before putting them in messages. The questions and the solutions are thoroughly researched before putting them in the contest. It is unlikely that the CodeVita platform will make an error in judging your the contest. It is unlikely that the CodeVita platform will make an error in judging your submission. If it marks your submission with a certain message, there are 99.9999% chances submission. If it marks your submission with a certain message, there are 99.9999% chances that your submission is
that your submission is incorrect.incorrect. 2.
2. Do not make errors in adhering to input / output formatsDo not make errors in adhering to input / output formats 3.
Closing Comments
Closing Comments
As stated in the opening paragraph of this document, the submissions are automatically evaluated As stated in the opening paragraph of this document, the submissions are automatically evaluated without human intervention. In order to meaningfully deal with such a system, all you need to do is without human intervention. In order to meaningfully deal with such a system, all you need to do is adhere to input / output specifications. Practice rounds are meant to be easy problems. Actual contest adhere to input / output specifications. Practice rounds are meant to be easy problems. Actual contest problems will be much more difficult.
problems will be much more difficult.
Our endeavour is to ensure that you do not get caught up in trivial issues such as Compile-Time Errors Our endeavour is to ensure that you do not get caught up in trivial issues such as Compile-Time Errors and focus more on getting the program logic correct
and focus more on getting the program logic correct. If you read up . If you read up the documents we have shared andthe documents we have shared and pay attention to system messages you will overcome these challenges and give yourself an opportunity pay attention to system messages you will overcome these challenges and give yourself an opportunity to solve interesting problems. That way it will be a win-win situation, because when you solve more to solve interesting problems. That way it will be a win-win situation, because when you solve more problems, we will derive more pleasure. Hope you will meaningfully utilize the opportunity that the problems, we will derive more pleasure. Hope you will meaningfully utilize the opportunity that the Practice round provides. All the Best !!!