Untitled
unknown
plain_text
5 months ago
10 kB
1
Indexable
const questions = { basic: { syntax: [ { question: "What is the correct way to declare a variable in Python?", options: ["var x = 5", "int x = 5", "x = 5", "variable x = 5"], correct: 2, topic: "syntax" }, { question: "How do you start an if statement in Python?", options: ["if (x > 5)", "if x > 5:", "if x > 5 then", "if (x > 5):"], correct: 1, topic: "syntax" }, { question: "Which of the following is the correct way to define a function in Python?", options: ["function myFunc():", "def myFunc():", "func myFunc():", "define myFunc():"], correct: 1, topic: "syntax" }, { question: "How do you comment a single line in Python?", options: ["// This is a comment", "# This is a comment", "/* This is a comment */", "<!-- This is a comment -->"], correct: 1, topic: "syntax" }, { question: "What is the correct syntax for a for loop in Python?", options: ["for i in range(5):", "for (i = 0; i < 5; i++)", "for i = 1 to 5", "foreach (i in range(5))"], correct: 0, topic: "syntax" } ], datatypes: [ { question: "What is the default value of a boolean variable in Python?", options: ["0", "null", "False", "None"], correct: 2, topic: "datatypes" }, { question: "Which datatype is used to store decimal numbers in Python?", options: ["int", "decimal", "double", "float"], correct: 3, topic: "datatypes" }, { question: "What is the data type of the value returned by input() function?", options: ["int", "float", "str", "bool"], correct: 2, topic: "datatypes" }, { question: "Which of the following is an immutable data type in Python?", options: ["list", "dictionary", "set", "tuple"], correct: 3, topic: "datatypes" }, { question: "What is the correct way to create an empty list in Python?", options: ["list()", "[]", "{}", "()"], correct: 1, topic: "datatypes" } ], operators: [ { question: "What is the result of 5 / 2 in Python?", options: ["2.5", "2", "2.0", "3"], correct: 0, topic: "operators" }, { question: "Which operator is used for string concatenation in Python?", options: ["+", "&", "||", ","], correct: 0, topic: "operators" }, { question: "What does the ** operator do in Python?", options: ["Multiplication", "Exponentiation", "Bitwise XOR", "Logical AND"], correct: 1, topic: "operators" }, { question: "What is the result of 10 % 3 in Python?", options: ["3.33", "1", "0", "3"], correct: 1, topic: "operators" }, { question: "Which operator is used to check if two values are identical in Python?", options: ["==", "===", "is", "equals"], correct: 2, topic: "operators" } ] }, intermediate: { functions: [ { question: "What is a lambda function in Python?", options: ["A named function", "An anonymous function", "A built-in function", "A recursive function"], correct: 1, topic: "functions" }, { question: "What does the *args parameter do in a function definition?", options: ["Allows multiple keyword arguments", "Allows multiple positional arguments", "Defines a default argument", "Creates a generator"], correct: 1, topic: "functions" }, { question: "Which of the following is true about Python functions?", options: ["They always return a value", "They can return multiple values", "They must have parameters", "They can't be nested"], correct: 1, topic: "functions" }, { question: "What is a decorator in Python?", options: ["A function that takes another function as an argument", "A class method", "A type of loop", "A built-in data structure"], correct: 0, topic: "functions" }, { question: "What does the 'yield' keyword do in Python?", options: ["Defines a generator function", "Raises an exception", "Returns multiple values", "Terminates the program"], correct: 0, topic: "functions" } ], data_structures: [ { question: "What is a list comprehension used for?", options: ["Creating dictionaries", "Creating lists concisely", "Sorting lists", "Merging lists"], correct: 1, topic: "data_structures" }, { question: "Which data structure in Python uses key-value pairs?", options: ["List", "Tuple", "Set", "Dictionary"], correct: 3, topic: "data_structures" }, { question: "What is the difference between a list and a tuple in Python?", options: ["Lists are ordered, tuples are not", "Tuples are mutable, lists are immutable", "Lists are immutable, tuples are mutable", "Lists are mutable, tuples are immutable"], correct: 3, topic: "data_structures" }, { question: "What does the enumerate() function do?", options: ["Counts the number of items in an iterable", "Returns an iterator of tuples containing indices and values", "Sorts an iterable", "Reverses an iterable"], correct: 1, topic: "data_structures" }, { question: "Which method is used to add an element to a set?", options: ["append()", "extend()", "add()", "insert()"], correct: 2, topic: "data_structures" } ], modules: [ { question: "How do you import a module in Python?", options: ["include module", "import module", "using module", "require module"], correct: 1, topic: "modules" }, { question: "What is the purpose of the 'if __name__ == \"__main__\":' idiom?", options: ["To define the main function", "To check if a module is being run directly", "To import built-in modules", "To create a class"], correct: 1, topic: "modules" }, { question: "Which module is used for working with regular expressions in Python?", options: ["regex", "re", "pyregex", "regexpression"], correct: 1, topic: "modules" }, { question: "What does the 'os' module primarily provide?", options: ["GUI functions", "Database operations", "Operating system dependent functionality", "Web scraping tools"], correct: 2, topic: "modules" }, { question: "How can you get all attributes and methods of an object?", options: ["object.methods()", "help(object)", "dir(object)", "object.attributes()"], correct: 2, topic: "modules" } ] }, advanced: { oop: [ { question: "What is multiple inheritance in Python?", options: ["A class inheriting from multiple parent classes", "A class with multiple objects", "A class with multiple methods", "A class with multiple attributes"], correct: 0, topic: "oop" }, { question: "What is the purpose of the __init__ method in a Python class?", options: ["To initialize class attributes", "To create a new instance", "To define class methods", "To delete an instance"], correct: 0, topic: "oop" }, { question: "What are metaclasses in Python?", options: ["Classes that inherit from other classes", "Classes that can't be instantiated", "Classes that define the behavior of other classes", "Classes with only static methods"], correct: 2, topic: "oop" }, { question: "What is method resolution order (MRO) in Python?", options: ["The order in which methods are defined in a class", "The order in which base classes are searched for a method", "The order in which objects are created", "The order in which modules are imported"], correct: 1, topic: "oop" }, { question: "What is a mixin in Python?", options: ["A type of multiple inheritance", "A class that provides methods to other classes", "A way to create singleton objects", "A method to combine two classes"], correct: 1, topic: "oop" } ], concurrency: [ { question: "What is the Global Interpreter Lock (GIL) in Python?", options: ["A lock that allows only one thread to execute in Python", "A way to share global variables between threads", "A method to prevent deadlocks", "A technique to optimize code execution"], correct: 0, topic: "concurrency" }, { question: "Which module is used for multi-threading in Python?", options: ["thread", "threading", "multithread", "parallel"], correct: 1, topic: "concurrency" }, { question: "What is the difference between multiprocessing and multi-threading in Python?", options: ["Multiprocessing uses multiple CPUs, multi-threading uses a single CPU", "Multi-threading is faster than multiprocessing", "Multiprocessing is only for GUI applications", "There is no difference"], correct: 0, topic: "concurrency" }, { question: "What is an asyncio event loop?", options: ["A type of infinite loop", "The core of async programming in Python", "A method to handle exceptions", "A way to create parallel processes"], correct: 1, topic: "concurrency" }, { question: "Which keyword is used to define a coroutine in Python?", options: ["async", "await", "yield", "return"], correct: 0, topic: "concurrency" } ], advanced_features: [ { question: "What are context managers in Python?", options: ["Classes that manage database connections", "Objects that define __enter__ and __exit__ methods", "Functions that handle exceptions", "Methods that manage memory allocation"], correct: 1, topic: "advanced_features" }, { question: "What is a generator expression in Python?", options: ["A function that generates random numbers", "A way to create lists", "A memory-efficient way to create iterables", "A method to generate new classes"], correct: 2, topic: "advanced_features" }, { question: "What is monkey patching in Python?", options: ["Dynamically modifying a class or module at runtime", "Creating a new subclass", "Fixing bugs in third-party libraries", "A technique for optimizing code"], correct: 0, topic: "advanced_features" }, { question: "What is the purpose of the @property decorator?", options: ["To define a static method", "To create read-only attributes", "To define a class method", "To allow getter and setter functionality for class attributes"], correct: 3, topic: "advanced_features" }, { question: "What are Python descriptors?", options: ["Special methods that describe a class", "Objects that define __get__, __set__, or __delete__ methods", "Functions that provide detailed information about objects", "A way to create documentation for classes"], correct: 1, topic: "advanced_features" } ] } };
Editor is loading...
Leave a Comment