Explain the difference between a value and a variable in Python, with one example each.
[3 marks]List two arithmetic operators and two comparison operators in Python, with a brief description of their use
[4 marks]Explain how to create a simple SQL database for storing basic genetic data, such as diseases and their associated gene functions (e.g., disease name, gene name, and a short description of the gene's role). Provide a brief overview of the design, along with key SQL commands to create the database and one table, insert sample data, and query it. Include 2-3 important SQL keywords with their uses in this context.
[7 marks]List three common string methods in Python and briefly describe what each does.
[3 marks]Write a simple Python program to calculate the area of a rectangle using variables and arithmetic operators. Include comments and print the result.
[4 marks]Explain basic sequence operations like length, indexing, and slicing using a DNA string example. Write a simple function that takes a DNA sequence (e.g., "ATCG"), calculates its length, indexes the first base, slices the middle half, and prints the results.
[7 marks]Describe lists as Python's "workhorse" for mutable data, including the list() function and basic ops like adding (+). Create a script that converts a string of gene names to a list, adds a new gene, and prints the updated list.
[7 marks]List three common methods for lists in Python and describe one briefly.
[3 marks]What is the output of 'Hello'[1:4] + ' ' + ('World' * 2)[0:5]?
[4 marks]Predict the output of the following code and analyze operator precedence:x = 10 y = "2" z = (x // 2) + int(y) * len("hi") > 10 print(z and "Python"[-1] == 'n')
[7 marks]What is the purpose of the break statement in a loop? Provide a one-line example. Page 1 of
[2 marks]Define a for loop in Python control flow. Write a script that uses a for loop to iterate over a list of fruits ("apple", "banana", "cherry"), prints each one, and counts the total items.
[4 marks]Explain slicing in sequences with a definition. Create a script that slices the middle bases from a DNA string "ATCGATCGGC", prints the slice and original length, then uses a simple if/else to check if the slice has more C's than A's
[7 marks]What is the output of len([1, 2, 3]) * 'ab'? Briefly explain the multiplication operation here.
[3 marks]Discuss adding and updating records in SQL. Provide INSERT and UPDATE commands with examples.
[4 marks]Define a Python list and its basic operation of adding elements with +. Write a simple script that starts with a list of colors ("red", "blue"), adds "green" using +, and prints the full list with its length.
[7 marks]Write a code snippet using min() and max() on a tuple. Explain their behavior on sequences.
[3 marks]What are data types in SQL? Give examples of two types and explain handling missing data with NULL
[4 marks]Explain exception handling in Python using the try-except statement. Write a function that reads a file, handles potential FileNotFoundError and ValueError exceptions, and uses a built-in function like len() to process string content. Discuss why exception handling is preferable to checking conditions manually.
[7 marks]State the role of SQL in database management and list two key features.
[3 marks]Differentiate between a while loop and a for loop. Provide a simple example of each for iterating over a list
[4 marks]Compare how operators behave on strings vs lists (e.g., +, *). Predict output for a mixed scenario: Python s = "py" l = [1, 2] print(s * 2 + str(l[0]) + l[1:])
[7 marks]Define SQL statements and categorize them into main types with one example each.
[3 marks]Describe adding sequences in Python (e.g., using +). Provide examples for strings and tuples, and explain why lists use + differently.
[4 marks]Enlist key features of strings, lists, and dictionaries (at least two each). Compare them in a table for mutability, ordering, and duplication support. Page 2 of
[2 marks]