<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<!-- question: 8180  -->
  <question type="coderunner">
    <name>
      <text>Code Ausgabe Arrays 05</text>
    </name>
    <questiontext format="markdown">
      <text>Enter the return value from the function func() in the field below!

```
{{ func }}
```</text>
    </questiontext>
    <generalfeedback format="markdown">
      <text></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>java_method</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>50, 100, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>5</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload>//Please enter the return value e.g int num = 50 
int num = ;</answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template><![CDATA[public class __tester__ {
    
    {{ STUDENT_ANSWER }}
    
    {{ func }}

    String testFunctionString = "{{ answer | e('java') }}";
    String studentAnswerString = "{{ STUDENT_ANSWER | e('java') }}";

    public static void main(String[] args) {
        __tester__ main = new __tester__();
        main.runTests();
    }

    public void runTests() {
        {{ TEST.testcode }};
    }
}]]></template>
    <iscombinatortemplate>0</iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams><![CDATA[import sys, json
from random import seed, randint

args = {param.split('=')[0]: param.split('=')[1] for param in sys.argv[1:]}
seed(args['seed'])

operators = ["<", "<=", ">", ">=", "==", "!="]
val1 = randint(0, 4)
val2 = randint(0, 4)
val3 = randint(10, 50)
val4 = randint(10, 50)
val5 = randint(10, 50)
var = operators[randint(0, len(operators)) - 1]  # Unused?

func = f"""public int func()
{{
    int[] arr = {{ {val1}, {val2}, {val3}, {val4}, {val5} }};
    
    int sum = 0;
    int x = 0;
    do
    {{
        sum += arr[x];
        x++;
    }} while (sum < 40);

    return sum;
}}
"""

print(json.dumps({"func": func}))
]]></templateparams>
    <hoisttemplateparams>1</hoisttemplateparams>
    <templateparamslang>python3</templateparamslang>
    <templateparamsevalpertry>1</templateparamsevalpertry>
    <templateparamsevald><![CDATA[{"func":"public int func()\n{\n    int[] arr = { 1, 0, 23, 11, 36 };\n    \n    int sum = 0;\n    int x = 0;\n    do\n    {\n        sum += arr[x];\n        x++;\n    } while (sum < 40);\n\n    return sum;\n}\n"}]]></templateparamsevald>
    <twigall>1</twigall>
    <uiplugin></uiplugin>
    <uiparameters></uiparameters>
    <attachments>0</attachments>
    <attachmentsrequired>0</attachmentsrequired>
    <maxfilesize>10240</maxfilesize>
    <filenamesregex></filenamesregex>
    <filenamesexplain></filenamesexplain>
    <displayfeedback>1</displayfeedback>
    <testcases>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000" >
      <testcode>
                <text>System.out.println(func()==num);</text>
      </testcode>
      <stdin>
                <text></text>
      </stdin>
      <expected>
                <text>true</text>
      </expected>
      <extra>
                <text></text>
      </extra>
      <display>
                <text>SHOW</text>
      </display>
    </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000" >
      <testcode>
                <text><![CDATA[System.out.println(studentAnswerString.contains("{") || studentAnswerString.contains("}"));]]></text>
      </testcode>
      <stdin>
                <text></text>
      </stdin>
      <expected>
                <text>false</text>
      </expected>
      <extra>
                <text></text>
      </extra>
      <display>
                <text>SHOW</text>
      </display>
    </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000" >
      <testcode>
                <text><![CDATA[System.out.println(studentAnswerString.contains("func()"));]]></text>
      </testcode>
      <stdin>
                <text></text>
      </stdin>
      <expected>
                <text>false</text>
      </expected>
      <extra>
                <text></text>
      </extra>
      <display>
                <text>SHOW</text>
      </display>
    </testcase>
    </testcases>
  </question>

</quiz>