From 30b48c30abebf75ed4b51fd034600e0c7d58c95b Mon Sep 17 00:00:00 2001 From: mahesh Date: Fri, 25 Aug 2017 01:33:08 +0530 Subject: Fixes order in demo_questions.zip - Template yaml is now generated on the fly. - Removes yaml_question_template files. - Fixes order for yaml file inside demo_questions.zip --- yaksh/demo_templates/yaml_question_template | 462 ---------------------------- 1 file changed, 462 deletions(-) delete mode 100644 yaksh/demo_templates/yaml_question_template (limited to 'yaksh/demo_templates/yaml_question_template') diff --git a/yaksh/demo_templates/yaml_question_template b/yaksh/demo_templates/yaml_question_template deleted file mode 100644 index 1309c06..0000000 --- a/yaksh/demo_templates/yaml_question_template +++ /dev/null @@ -1,462 +0,0 @@ ---- -testcase: -- test_case_type: |- - integertestcase - correct: 2 -- test_case_type: |- - integertestcase - correct: -3 -files: [] -language: |- # bash, scilab, python, c/c++, java - python -partial_grading: false -tags: -- python -- quadratic -- demo -- integer -points: 1.0 -snippet: '' -active: true -type: |- - integer -description: |- - Type in the box below, one of the roots to the following quadratic equation? -
- - - x - 2 - - + - x - - - 6 - = - 0 - -summary: |- - Roots of quadratic equation -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - stringtestcase - correct: |- - (2, 'HelloHello', ':', 'Bye') - string_check: |- # exact or lower - exact -files: [] -language: |- - python -partial_grading: false -tags: -- python -- demo -- print -- string -- '1' -- case_sensitive -- casesensitive -- python2 -points: 1.0 -snippet: '' -active: true -type: |- - string -description: |- - What is the output for the following code in Python 2.x: -
- - print(2, "Hello"*2, ":" ,"Bye") - -summary: |- - Print Output -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - floattestcase - correct: 5.5786 - error_margin: 0.0 -files: [] -language: |- - python -partial_grading: false -tags: -- float -- '1' -- python -- decimal -- demo -points: 1.0 -snippet: '' -active: true -type: |- - float -description: |- - Write down the resultant value of the following - -
3.4566+2.122
-  

-summary: |- - Adding decimals -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - standardtestcase - test_case_args: |- - file1.csv file2.csv file3.csv - test_case: |- - #!/bin/bash - cat $1 | cut -d: -f2 | paste -d: $3 - $2 - weight: 1.0 -files: -- - file1.csv - - false -- - file2.csv - - false -- - file3.csv - - false -language: |- - bash -partial_grading: false -tags: -- demo -- code -- files -- concatenate -- bash -- delimiter -- '2' -points: 2.0 -snippet: |- - #!/bin/bash -active: true -type: |- - code -description: |- - Write a bash script that takes exactly three file arguments. - - The first argument (file1.csv) would have 3 columns, the second argument (file2.csv) would have 2 columns. The third argument (file3.csv) would have 2 columns. -

- All files have columns delimited by : (colon). -

- We need the 2nd column from file1.csv to be removed and concatenated BEFORE file2.csv and this concatenated file should come BESIDE file3.csv. - - Left is file3.csv, and the LATER columns come from file1.csv and file2.csv. -

- The delimiter while putting the files BESIDE each other should again be : (colon) -

-
-  Note: - Do not hard-code the filenames. They will be passed in as arguments.
-  Assume no headers (to avoid header-non-repetition issues).
-  
-summary: |- - Extract columns from files -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - standardtestcase - test_case_args: '' - test_case: |- - assert is_palindrome("hello") == False - weight: 1.0 -- test_case_type: |- - standardtestcase - test_case_args: '' - test_case: |- - assert is_palindrome("nitin") == True - weight: 1.0 -- test_case_type: |- - standardtestcase - test_case_args: '' - test_case: |- - assert is_palindrome("madaM") == False - weight: 1.0 -files: [] -language: |- - python -partial_grading: false -tags: -- python -- assertion -- palindrome -- reverse -- code -- '2' -- demo -points: 2.0 -snippet: |- - def is_palindrome(s): -active: true -type: |- - code -description: |- - Write a function is_palindrome(arg) which will take one string argument. -
- Return True if the argument is palindrome & False otherwise. -
- The function should be case sensitive. -

- For Example:
is_palindrome("Hello") should return False
-summary: |- - Check Palindrome -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - stdiobasedtestcase - weight: 1 - expected_input: |- - string - expected_output: |- - s - t - r - i - n - g -- test_case_type: |- - stdiobasedtestcase - weight: 1 - expected_input: |- - s t o p s i g n - expected_output: |- - s - - t - - o - - p - - s - - i - - g - - n -- test_case_type: |- - hooktestcase - 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 - weight: 1.0 -files: [] -language: |- - python -partial_grading: true -tags: -- python -- stdio -- demo -- '1' -- code -- for -points: 1.0 -snippet: '' -active: true -type: |- - code -description: |- - Write a python script that accepts a string as input -
- The script must print each character of the string using a for loop. - - For example; -
-  Input:
-  box
-  Output
-  b
-  o
-  x
-  
-summary: |- - For Loop over String -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - standardtestcase - test_case_args: '' - test_case: |- - #include - #include - - extern int add(int, int, int); - - template - void check(T expect,T result) - { - if (expect == result) - { - printf("\nCorrect:\n Expected %d got %d \n",expect,result); - } - else - { - printf("\nIncorrect:\n Expected %d got %d \n",expect,result); - exit (1); - } - } - - int main(void) - { - int result; - result = add(0,0,0); - printf("Input submitted to the function: 0, 0, 0"); - check(0, result); - result = add(2,3,3); - printf("Input submitted to the function: 2, 3, 3"); - check(8,result); - printf("All Correct\n"); - } - weight: 1.0 -files: [] -language: |- - c -partial_grading: false -tags: -- c++ -- c -- demo -- code -- '2' -- addition -- cpp -- numbers -points: 2.0 -snippet: '' -active: true -type: |- - code -description: |- - Write a program to add 3 numbers. -
- Function Name is to be called add -
-

-
-  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.
-  
-summary: |- - Add 3 numbers -grade_assignment_upload: false ---- -testcase: -- test_case_type: |- - hooktestcase - 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 - weight: 1.0 -files: [] -language: |- - python -partial_grading: false -tags: -- python -- '1' -- file -- hook -- hello -- world -- grade -- assignment -- upload -- demo -points: 1.0 -snippet: '' -active: true -type: |- - upload -description: |- - Upload a file called new.txt which contains the string Hello, World! in it. -summary: |- - Hello World in File -grade_assignment_upload: true ---- -testcase: -- test_case_type: |- - mcqtestcase - correct: false - options: |- - s.reverse() -- test_case_type: |- - mcqtestcase - correct: true - options: |- - s[::-1] -- test_case_type: |- - mcqtestcase - correct: false - options: |- - reversed(s) -- test_case_type: |- - mcqtestcase - correct: true - options: |- - "''.join(reversed(s)) -files: [] -language: |- - python -partial_grading: false -tags: -- python -- '2' -- reverse -- mcc -- demo -points: 2.0 -snippet: '' -active: true -type: |- - mcc -description: |- - Which of the following options would reverse the string? -summary: |- - Reverse a string -grade_assignment_upload: false -- cgit