---
active: true # question status = true or false
language: |- # bash, scilab, python, c/c++, java
python
partial_grading: false
snippet: ''
summary: |-
Roots of quadratic equation
type: |-
integer
grade_assignment_upload: false
description: |- # Entire question description.
Type in the box below, one of the roots to the following quadratic equation?
points: 1.0
testcase:
- test_case_type: |-
integertestcase
correct: 2
- test_case_type: |-
integertestcase
correct: -3
files: []
---
active: true
language: |-
python
partial_grading: false
snippet: ''
summary: |-
Print Output
type: |-
string
grade_assignment_upload: false
description: |-
What is the output for the following code in Python 2.x:
print(2, "Hello"*2, ":" ,"Bye")
points: 1.0
testcase:
- string_check: |- #exact or lower
exact
test_case_type: |-
stringtestcase
correct: |-
(2, 'HelloHello', ':', 'Bye')
files: []
---
active: true
language: |-
python
partial_grading: false
snippet: ''
summary: |-
Adding decimals
type: |-
float
grade_assignment_upload: false
description: |-
Write down the resultant value of the following -
3.4566+2.122
Note: - Do not hard-code the filenames. They will be passed in as arguments. Assume no headers (to avoid header-non-repetition issues).points: 2.0 testcase: - test_case: |- #!/bin/bash cat $1 | cut -d: -f2 | paste -d: $3 - $2 weight: 1.0 test_case_type: |- standardtestcase test_case_args: |- file1.csv file2.csv file3.csv files: - - file1.csv - false - - file2.csv - false - - file3.csv - false --- active: true language: |- python partial_grading: false snippet: |- def is_palindrome(s): summary: |- Check Palindrome type: |- code grade_assignment_upload: false description: |- Write a function
is_palindrome(arg)
which will take one string argument.
is_palindrome("Hello")
should return False
Input: box Output b o xpoints: 1.0 testcase: - expected_output: |- s t r i n g weight: 1 test_case_type: |- stdiobasedtestcase expected_input: |- string - expected_output: |- s t o p s i g n weight: 1 test_case_type: |- stdiobasedtestcase expected_input: |- s t o p s i g n - hook_code: |- def check_answer(user_answer): ''' Evaluates user answer to return - success - Boolean, indicating if code was executed correctly mark_fraction - Float, indicating fraction of the weight to a test case error - String, error message if success is false In case of assignment upload there will be no user answer ''' success = False err = "You are using while in your code." mark_fraction = 0.0 if not 'while' in user_answer: success=True err = "Correct Answer" mark_fraction = 1.0 return success, err, mark_fraction test_case_type: |- hooktestcase weight: 1.0 files: [] --- active: true language: |- c partial_grading: false snippet: '' summary: |- Add 3 numbers type: |- code grade_assignment_upload: false description: |- Write a program to add 3 numbers.
Note: You do not have to print anything, neither you have to make the function call. Just define the function to perform the required operation, return the output & click on check answer. Also, note that the function name should exactly be as mentioned above.points: 2.0 testcase: - test_case: |- #include
new.txt
which contains the string Hello, World!
in it.
points: 1.0
testcase:
- hook_code: |-
def check_answer(user_answer):
''' Evaluates user answer to return -
success - Boolean, indicating if code was executed correctly
mark_fraction - Float, indicating fraction of the
weight to a test case
error - String, error message if success is false
In case of assignment upload there will be no user answer '''
success = False
err = "Incorrect Answer" # Please make this more specific
mark_fraction = 0.0
try:
with open('new.txt', 'r') as f:
if "Hello, World!" in f.read():
success = True
err = "Correct Answer"
mark_fraction = 1.0
else:
err = "Did not found string Hello, World! in file."
except IOError:
err = "File new.txt not found."
return success, err, mark_fraction
test_case_type: |-
hooktestcase
weight: 1.0
files: []