|
815 | 815 | "explanation": "The division is performed from left to right. '12 / 4' equals 3, and then '3 / 3' equals 1.",
|
816 | 816 | "correctAnswer": "1.0",
|
817 | 817 | "incorrectAnswers": ["4", "0", "9", "0.5", "2.0"]
|
| 818 | + }, |
| 819 | + { |
| 820 | + "difficulty": "beginner", |
| 821 | + "question": "What is the result of the following Python expression?", |
| 822 | + "codeSnippet": "7 % 2", |
| 823 | + "explanation": "The modulo operator '%' in Python returns the remainder of the division. Here, 7 % 2 results in 1 since 7 divided by 2 leaves a remainder of 1.", |
| 824 | + "correctAnswer": "1", |
| 825 | + "incorrectAnswers": ["3.5", "2", "0", "7", "None"] |
| 826 | + }, |
| 827 | + { |
| 828 | + "difficulty": "beginner", |
| 829 | + "question": "What will be the output of the following Python code snippet?", |
| 830 | + "codeSnippet": "my_list = ['a', 'b', 'c', 'd']\nprint(len(my_list))", |
| 831 | + "explanation": "The 'len()' function in Python returns the number of items in an object. Here, 'my_list' contains four items, so 'len(my_list)' returns 4.", |
| 832 | + "correctAnswer": "4", |
| 833 | + "incorrectAnswers": [ |
| 834 | + "3", |
| 835 | + "'abcd'", |
| 836 | + "['a', 'b', 'c', 'd']", |
| 837 | + "None", |
| 838 | + "AttributeError" |
| 839 | + ] |
| 840 | + }, |
| 841 | + { |
| 842 | + "difficulty": "beginner", |
| 843 | + "question": "What does the following Python code output?", |
| 844 | + "codeSnippet": "print('Python' + 'Quiz')", |
| 845 | + "explanation": "The '+' operator concatenates two strings in Python. Here, 'Python' + 'Quiz' results in the string 'PythonQuiz'.", |
| 846 | + "correctAnswer": "'PythonQuiz'", |
| 847 | + "incorrectAnswers": [ |
| 848 | + "'QuizPython'", |
| 849 | + "'Python Quiz'", |
| 850 | + "'PythonQuizPython'", |
| 851 | + "'Quiz'", |
| 852 | + "ValueError" |
| 853 | + ] |
| 854 | + }, |
| 855 | + { |
| 856 | + "difficulty": "beginner", |
| 857 | + "question": "What is the output of the following Python code snippet?", |
| 858 | + "codeSnippet": "a = 10\nb = 20\nprint(a > b)", |
| 859 | + "explanation": "The '>' operator checks if the value on the left is greater than the value on the right. Here, 'a > b' is 'False' since 10 is not greater than 20.", |
| 860 | + "correctAnswer": "False", |
| 861 | + "incorrectAnswers": ["True", "'10 > 20'", "'20 > 10'", "None", "10"] |
| 862 | + }, |
| 863 | + { |
| 864 | + "difficulty": "beginner", |
| 865 | + "question": "What does the following Python code snippet output?", |
| 866 | + "codeSnippet": "my_dict = {'a': 1, 'b': 2}\nprint(my_dict['b'])", |
| 867 | + "explanation": "In Python, a dictionary value can be accessed by using its corresponding key. Here, 'my_dict['b']' accesses the value associated with the key 'b', which is 2.", |
| 868 | + "correctAnswer": "2", |
| 869 | + "incorrectAnswers": [ |
| 870 | + "1", |
| 871 | + "'a'", |
| 872 | + "{'a': 1, 'b': 2}", |
| 873 | + "KeyError", |
| 874 | + "RecursionError" |
| 875 | + ] |
818 | 876 | }
|
819 | 877 | ],
|
820 | 878 | "medium": [
|
|
0 commit comments