Class 7 (Coding)
Chapter 1: Ethical Practices in Coding
1. What does ethical coding ensure?
○ Option 1: Copying code from the internet
○ Option 2: Fair practices and respect for others' work
○ Option 3: Ignoring errors in the code
○ Option 4: Hiding the origin of the code
Answer: Option 2: Fair practices and respect for others' work
2. Which of the following is a best practice in ethical coding?
○ Option 1: Claiming other's work as your own
○ Option 2: Giving proper credit to original authors
○ Option 3: Ignoring licenses and permissions
○ Option 4: Using other people's code without understanding it
Answer: Option 2: Giving proper credit to original authors
3. What should you do when you use someone else's code in your program?
○ Option 1: Hide the fact that you are using someone else’s code
○ Option 2: Always give credit to the original author
○ Option 3: Modify the code and claim it as your own
○ Option 4: Ignore the code's licensing
Answer: Option 2: Always give credit to the original author
4. Which of the following is an ethical coding practice?
○ Option 1: Providing misleading claims about the software's abilities
○ Option 2: Never disclosing the limitations of your software
○ Option 3: Acknowledging all contributions made by others
○ Option 4: Taking credit for a bug-free software
Answer: Option 3: Acknowledging all contributions made by others
5. What should you do if you don't understand the code you are using from someone
else?
○ Option 1: Use it without worrying
○ Option 2: Seek permission and provide credit to the author
○ Option 3: Modify it to suit your needs
○ Option 4: Ignore the documentation and use it anyway
Answer: Option 2: Seek permission and provide credit to the author
6. Which principle applies when using others’ code in your work?
○ Option 1: Ownership
○ Option 2: Transparency
○ Option 3: Secrecy
○ Option 4: Plagiarism
Answer: Option 2: Transparency
7. How should a programmer behave when using open-source code?
○ Option 1: Modify it and redistribute without credit
○ Option 2: Always adhere to the license and provide credit
○ Option 3: Only use it in paid projects
○ Option 4: Never use open-source code
Answer: Option 2: Always adhere to the license and provide credit
8. What does it mean to write “clean code”?
○ Option 1: Code that works but is hard to understand
○ Option 2: Code that is efficient and easy to maintain
○ Option 3: Code with no errors
○ Option 4: Code that is written in a secret format
Answer: Option 2: Code that is efficient and easy to maintain
9. What is the most ethical practice when disclosing your programming skills?
○ Option 1: Exaggerate your skills to get a job
○ Option 2: Be honest about your abilities
○ Option 3: Claim to be an expert when you're not
○ Option 4: Never mention your limitations
Answer: Option 2: Be honest about your abilities
10. Which of the following is an example of unethical coding?
○ Option 1: Using someone else’s code without permission
○ Option 2: Properly commenting your code
○ Option 3: Collaborating with others and giving credit
○ Option 4: Following coding standards
Answer: Option 1: Using someone else’s code without permission
Chapter 2: Variables in Real Life
1. What is variable initialization in programming?
○ Option 1: Declaring a variable
○ Option 2: Assigning a value to a variable before use
○ Option 3: Creating a loop
○ Option 4: Writing a function
Answer: Option 2: Assigning a value to a variable before use
2. Which data type is used for storing whole numbers in Python?
○ Option 1: Integer
○ Option 2: String
○ Option 3: Float
○ Option 4: Boolean
Answer: Option 1: Integer
3. Which of the following is used to store textual data in Python?
○ Option 1: Integer
○ Option 2: String
○ Option 3: Boolean
○ Option 4: Float
Answer: Option 2: String
4. What is the result of the expression x = 5 + 3 in Python?
○ Option 1: 8
○ Option 2: 53
○ Option 3: 15
○ Option 4: Error
Answer: Option 1: 8
5. What happens if a variable is used without being initialized?
○ Option 1: It is automatically assigned a value
○ Option 2: It causes an error
○ Option 3: It stores a null value
○ Option 4: It stores random data
Answer: Option 2: It causes an error
6. Which Python statement is correct for initializing a variable x with the value 10?
○ Option 1: int x = 10
○ Option 2: x = 10
○ Option 3: float x = 10
○ Option 4: x := 10
Answer: Option 2: x = 10
7. Which of the following is NOT a valid variable name in Python?
○ Option 1: var_1
○ Option 2: _var
○ Option 3: 1var
○ Option 4: var1
Answer: Option 3: 1var
8. Which of the following operations is valid for a string in Python?
○ Option 1: x = "Hello" + " World"
○ Option 2: x = "Hello" - "World"
○ Option 3: x = "Hello" * 2
○ Option 4: x = "Hello" / 2
Answer: Option 1: x = "Hello" + " World"
9. What data type is the value of x = 3.14 in Python?
○ Option 1: Integer
○ Option 2: String
○ Option 3: Float
○ Option 4: Boolean
Answer: Option 3: Float
10. Which Python data type represents a true or false value?
○ Option 1: Integer
○ Option 2: String
○ Option 3: Boolean
○ Option 4: Float
Answer: Option 3: Boolean
Chapter 3: Sequencing with Block Coding
1. What is sequencing in programming?
○ Option 1: Repeating a block of code
○ Option 2: Arranging tasks in a specific order
○ Option 3: Making a decision based on a condition
○ Option 4: Storing multiple values in one place
Answer: Option 2: Arranging tasks in a specific order
2. Which of the following is an example of a programming bug?
○ Option 1: A typo that causes the program to crash
○ Option 2: An extra function that makes the code longer
○ Option 3: Using a loop when not needed
○ Option 4: Calling a function multiple times
Answer: Option 1: A typo that causes the program to crash
3. What is the purpose of a loop in programming?
○ Option 1: To store multiple variables
○ Option 2: To repeat a block of code until a condition is met
○ Option 3: To make decisions in the program
○ Option 4: To print output to the screen
Answer: Option 2: To repeat a block of code until a condition is met
4. What will happen if the steps in a sequence are not followed in order?
○ Option 1: The program will still work
○ Option 2: The output may be incorrect or cause errors
○ Option 3: The program will run faster
○ Option 4: The program will stop
Answer: Option 2: The output may be incorrect or cause errors
5. Which block in a programming sequence controls the flow based on conditions?
○ Option 1: Loop
○ Option 2: Function
○ Option 3: Conditional (If-Else)
○ Option 4: Variable
Answer: Option 3: Conditional (If-Else)
6. Which of the following is a characteristic of a good algorithm?
● Option 1: It is complex and difficult to understand
● Option 2: It solves the problem step by step in a clear manner
● Option 3: It uses nested loops without any reason
● Option 4: It does not consider user input
Answer: Option 2: It solves the problem step by step in a clear manner
7. Which of the following is a valid way to handle bugs in programming?
● Option 1: Ignore the bug and continue programming
● Option 2: Identify and fix the problem systematically
● Option 3: Write more complex code to hide the bug
● Option 4: Restart the computer
Answer: Option 2: Identify and fix the problem systematically
8. Which block in a sequence is used to end a process or terminate a program?
● Option 1: Break
● Option 2: Continue
● Option 3: End/Stop
● Option 4: Loop
Answer: Option 3: End/Stop
9. What does a ‘Continue’ statement do in a loop?
● Option 1: Ends the loop
● Option 2: Skips the remaining code in the current iteration and moves to the next
iteration
● Option 3: Repeats the loop indefinitely
● Option 4: Starts a new loop
Answer: Option 2: Skips the remaining code in the current iteration and moves to the
next iteration
10. Which type of sequence is used to swap two numbers in an algorithm?
● Option 1: Iterative sequence
● Option 2: Conditional sequence
● Option 3: Sequential sequence
● Option 4: Random sequence
Answer: Option 3: Sequential sequence
Chapter 4: Fun with Functions
1. What is the main purpose of a function in programming?
○ Option 1: To execute code only once
○ Option 2: To reduce code repetition by grouping related tasks
○ Option 3: To store data for long-term use
○ Option 4: To make programs more complex
Answer: Option 2: To reduce code repetition by grouping related tasks
2. What is the advantage of using functions in a program?
○ Option 1: They make the program run slower
○ Option 2: They reduce code readability
○ Option 3: They help organize code and improve reusability
○ Option 4: They prevent errors in the program
Answer: Option 3: They help organize code and improve reusability
3. What is a function parameter?
○ Option 1: The output that a function returns
○ Option 2: The variables passed into a function for processing
○ Option 3: The name of the function
○ Option 4: A special keyword used inside a function
Answer: Option 2: The variables passed into a function for processing
4. What is the correct syntax for defining a function in Python?
○ Option 1: function name() { }
○ Option 2: def functionName():
○ Option 3: func name:
○ Option 4: define functionName()
Answer: Option 2: def functionName():
5. Which of the following is an example of a function that does not take any
parameters?
○ Option 1: def greet(name):
○ Option 2: def sayHello():
○ Option 3: def add(x, y):
○ Option 4: def multiply(a, b):
Answer: Option 2: def sayHello():
6. How do you call a function in Python?
○ Option 1: functionName{}
○ Option 2: call functionName()
○ Option 3: functionName()
○ Option 4: invoke functionName
Answer: Option 3: functionName()
7. Which of the following statements is true about functions?
○ Option 1: A function must always return a value
○ Option 2: A function cannot take parameters
○ Option 3: A function can return a value or perform an action but not both
○ Option 4: A function can have a return statement and perform actions within it
Answer: Option 4: A function can have a return statement and perform actions within it
8. Which of the following is NOT a benefit of using functions?
○ Option 1: Reduced code redundancy
○ Option 2: Improved code organization
○ Option 3: More difficult to understand code
○ Option 4: Increased reusability of code
Answer: Option 3: More difficult to understand code
9. What does the 'return' statement do in a function?
○ Option 1: It ends the function
○ Option 2: It sends back a result to the place where the function was called
○ Option 3: It calls the function again
○ Option 4: It prints a message
Answer: Option 2: It sends back a result to the place where the function was called
10. Which of the following is an example of a function returning a value?
○ Option 1: def add(x, y): return x + y
○ Option 2: def multiply(x, y): print(x * y)
○ Option 3: def greet(name): print("Hello", name)
○ Option 4: def sayHi(): pass
Answer: Option 1: def add(x, y): return x + y
Chapter 4: Fun with Functions
1. What is a function in programming?
○ Option 1: A block of code that performs a specific task
○ Option 2: A loop that repeats a block of code
○ Option 3: A collection of variables
○ Option 4: A data type
Answer: Option 1: A block of code that performs a specific task
2. Why do we use functions in programming?
○ Option 1: To make the code longer and more complex
○ Option 2: To reduce code redundancy and improve readability
○ Option 3: To store data temporarily
○ Option 4: To create loops within the code
Answer: Option 2: To reduce code redundancy and improve readability
3. What is a parameter in a function?
○ Option 1: A value returned by the function
○ Option 2: A variable defined inside the function
○ Option 3: A value passed into the function to be used within it
○ Option 4: The name of the function
Answer: Option 3: A value passed into the function to be used within it
4. What does the term "function call" refer to in programming?
○ Option 1: Declaring a function
○ Option 2: Returning a value from a function
○ Option 3: Using a function in the program
○ Option 4: Defining the parameters of a function
Answer: Option 3: Using a function in the program
5. Which of the following is an advantage of using functions?
○ Option 1: Functions make the code longer
○ Option 2: Functions improve readability and make code more manageable
○ Option 3: Functions are only useful for debugging
○ Option 4: Functions increase the complexity of the code
Answer: Option 2: Functions improve readability and make code more
manageable
6. What is the purpose of returning a value from a function?
○ Option 1: To end the function
○ Option 2: To pass a result back to the program to be used later
○ Option 3: To call the function again
○ Option 4: To initialize a new variable
Answer: Option 2: To pass a result back to the program to be used later
7. What does the term "DRY" stand for in programming?
○ Option 1: Do Repeat Yourself
○ Option 2: Do Read Your code
○ Option 3: Don't Repeat Yourself
○ Option 4: Do Restructure Your code
Answer: Option 3: Don't Repeat Yourself
8. Which type of function does NOT take parameters?
○ Option 1: Functions with a return value
○ Option 2: Functions that print output
○ Option 3: Functions that perform calculations
○ Option 4: Functions without parameters
Answer: Option 4: Functions without parameters
9. Which of the following statements is correct about functions?
○ Option 1: Functions can only be called once in a program
○ Option 2: Functions help to break down the code into smaller, manageable
parts
○ Option 3: Functions must return a value every time they are called
○ Option 4: Functions cannot take input parameters
Answer: Option 2: Functions help to break down the code into smaller,
manageable parts
10. What does the return statement do in a function?
○ Option 1: Stops the execution of the function
○ Option 2: Calls the function again
○ Option 3: Sends a value back to the point where the function was called
○ Option 4: Prints the output to the screen
Answer: Option 3: Sends a value back to the point where the function was called
Chapter 5: Understanding Arrays & Collections
1. What is an array in programming?
○ Option 1: A collection of elements of the same data type
○ Option 2: A data type that stores multiple types of values
○ Option 3: A collection of functions
○ Option 4: A variable that stores a single element
Answer: Option 1: A collection of elements of the same data type
2. Which of the following is NOT a type of collection in programming?
○ Option 1: Array
○ Option 2: List
○ Option 3: Set
○ Option 4: Boolean
Answer: Option 4: Boolean
3. What is the main advantage of using arrays?
○ Option 1: Arrays can store only one type of data
○ Option 2: Arrays can store multiple types of data in one variable
○ Option 3: Arrays help group similar data together for easy access
○ Option 4: Arrays are not very useful in programming
Answer: Option 3: Arrays help group similar data together for easy access
4. Which of the following is a correct way to access an element in an array in
Python?
○ Option 1: arr[1]
○ Option 2: [Link](1)
○ Option 3: arr(1)
○ Option 4: arr[0]
Answer: Option 1: arr[1] (Arrays are zero-indexed)
5. How do you modify an element in an array?
○ Option 1: Use the index and assign a new value
○ Option 2: Use a function to modify the value
○ Option 3: Arrays cannot be modified
○ Option 4: Use the modify() method
Answer: Option 1: Use the index and assign a new value
6. What does the term "iterating over an array" mean?
○ Option 1: Assigning a value to an element in the array
○ Option 2: Accessing and performing operations on each element in the
array
○ Option 3: Sorting the array
○ Option 4: Creating a new array from the old one
Answer: Option 2: Accessing and performing operations on each element in the
array
7. Which of the following is an example of an array?
○ Option 1: arr = [1, 2, "hello", True]
○ Option 2: arr = [1, 2, 3, 4]
○ Option 3: arr = ["apple", "banana"]
○ Option 4: arr = [1, 2, "hello", True] (mixing data types)
Answer: Option 2: arr = [1, 2, 3, 4]
8. Which of the following operations can be performed on arrays?
○ Option 1: Sorting
○ Option 2: Looping through elements
○ Option 3: Modifying values
○ Option 4: All of the above
Chapter 6: Hello World with Code
1. What is a programming language used for?
○ Option 1: To create hardware components
○ Option 2: To write instructions for the computer to execute
○ Option 3: To manage databases
○ Option 4: To organize files on a computer
Answer: Option 2: To write instructions for the computer to execute
2. What does "high-level programming language" mean?
○ Option 1: A language that is closer to machine code
○ Option 2: A language that is closer to human language
○ Option 3: A language that only runs on specific machines
○ Option 4: A language that uses only binary code
Answer: Option 2: A language that is closer to human language
3. Which of the following is an example of a high-level programming language?
○ Option 1: Assembly
○ Option 2: Python
○ Option 3: Machine code
○ Option 4: Binary
Answer: Option 2: Python
4. Which of the following is NOT a characteristic of a low-level programming
language?
○ Option 1: It is closer to machine code
○ Option 2: It is easier to understand for humans
○ Option 3: It requires detailed knowledge of the computer’s hardware
○ Option 4: It is harder to learn
Answer: Option 2: It is easier to understand for humans
5. Which of the following is an advantage of using high-level languages?
○ Option 1: They are faster to execute
○ Option 2: They are easier to learn and use
○ Option 3: They are more difficult to debug
○ Option 4: They require manual memory management
Answer: Option 2: They are easier to learn and use
6. What is the main role of a compiler in programming?
○ Option 1: It translates high-level language into machine code
○ Option 2: It organizes variables
○ Option 3: It stores the program
○ Option 4: It generates reports on program errors
Answer: Option 1: It translates high-level language into machine code
7. Which of the following is a characteristic of machine language?
○ Option 1: It is difficult for humans to read and write
○ Option 2: It uses symbols to represent instructions
○ Option 3: It is closer to human-readable code
○ Option 4: It uses higher-level abstractions
Answer: Option 1: It is difficult for humans to read and write
8. Which programming language is used for building most websites?
○ Option 1: Python
○ Option 2: JavaScript
○ Option 3: C++
○ Option 4: HTML
Answer: Option 2: JavaScript
9. What makes a high-level language "high-level"?
○ Option 1: It is machine-readable
○ Option 2: It uses commands that are easy for humans to understand
○ Option 3: It only works on specific hardware
○ Option 4: It only deals with binary code
Answer: Option 2: It uses commands that are easy for humans to understand
10. What is a primary disadvantage of using low-level programming languages?
○ Option 1: They are harder to debug
○ Option 2: They require a lot of memory
○ Option 3: They are easier to learn
○ Option 4: They are slower to execute
Answer: Option 1: They are harder to debug