summaryrefslogtreecommitdiff
path: root/yaksh/demo_templates/yaml_question_template
blob: 065072c67e6ebcdc3fbf7f1f42b48f43d1600759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
---
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?
  <br/>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <msup>
      <mi>x</mi>
      <mn>2</mn>
    </msup>
    <mo>+</mo>
    <mi>x</mi>
    <mo>-</mo>
    <mi>6</mi>
    <mo>=</mo>
    <mn>0</mn>
  </math>
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 <b>Python 2.x</b>:
  <br>
  <code>
  print(2, "Hello"*2, ":" ,"Bye")
  </code>
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 -
  <pre>3.4566+2.122
  </pre><br/>
points: 1.0
testcase:
- test_case_type: |-
    floattestcase
  correct: 5.5786
  error_margin: 0.0
files: []
---
active: true
language: |-
  bash
partial_grading: false
snippet: |-
  #!/bin/bash
summary: |-
  Extract columns from files
type: |-
  code
grade_assignment_upload: false
description: |-
  Write a bash script that takes exactly three file arguments.
  
  The first argument <b>(file1.csv)</b> would have 3 columns, the second argument <b>(file2.csv)</b> would have 2 columns. The third argument <b>(file3.csv) </b>would have 2 columns.
  <br><br>
  All files have columns delimited by <b>: (colon)</b>.
  <br><br>
  We need the <b>2nd column</b> from <b>file1.csv</b> to be removed and concatenated <b>BEFORE file2.csv</b> and this concatenated file should come <b>BESIDE file3.csv</b>.
  
  Left is <b>file3.csv</b>, and the <b>LATER</b> columns come from <b>file1.csv and file2.csv.</b>
  <br><br>
  <b>The delimiter while putting the files BESIDE each other should again be : (colon)</b>
  <br><br>
  <pre>
  <b>Note:</b> - <i>Do not hard-code the filenames. They will be passed in as arguments.
  Assume no headers (to avoid header-non-repetition issues).</i>
  </pre>
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 <code>is_palindrome(arg)</code> which will take one string argument.
  <br>
  Return True if the argument is palindrome & False otherwise.
   <br>
  The function should be case sensitive.
  <br><br>
  For Example:<br><code>is_palindrome("Hello")</code> should return <code>False</code><br>
points: 2.0
testcase:
- 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
  test_case_type: |-
    standardtestcase
  test_case_args: ''
files: []
---
active: true
language: |-
  python
partial_grading: true
snippet: ''
summary: |-
  For Loop over String
type: |-
  code
grade_assignment_upload: false
description: |-
  Write a python script that accepts a <b>string</b> as input
  <br>
  The script must print each character of the string using a for loop.
  
  For example;
  <pre>
  <b>Input:</b>
  box
  <b>Output</b>
  b
  o
  x
  </pre>
points: 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. 
  <br>
  Function Name is to be called <b>add</b>
  <br>
  <br><br>
  <pre>
  <b>Note:</b><i> 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.</i>
  </pre>
points: 2.0
testcase:
- test_case: |-
    #include <stdio.h>
    #include <stdlib.h>
    
    extern int add(int, int, int);
    
    template <class T>
    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
  test_case_type: |-
    standardtestcase
  test_case_args: ''
files: []
---
active: true
language: |-
  python
partial_grading: false
snippet: ''
summary: |-
  Hello World in File
type: |-
  upload
grade_assignment_upload: true
description: |-
  Upload a file called <code>new.txt</code> which contains the string <code>Hello, World!</code>  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: []