1/25
Looks like no tags are added yet.
Which chart is generally best for comparing values across categories?
Bar chart
Which of the following is a python variable
Student_scores
What does df["Total"] = df["Quiz"] + df["Exam"] do?
Creates a new Total column by adding the Quiz and Exam values in each row
Which Pandas indexer selects rows and columns by their labels rather than by position?
.loc
Which widely used Python library is highly flexible for creating many kinds of plots and charts?
Matplotlib
What does tail() usually return for a Pandas DataFrame?
The last few rows
What does print(df.iloc[2]) print?
The row for index 2 (StudentID S3, Score 75)
What does the input function returns when the user types it?
String (str) data type
Which Python library provides data structures and functions for efficient tabular data?
Pandas
Prediction in data science mainly means what?
Using known information to estimate unknown values
What does plt.scatter(study_hours, exam_scores) create?
A scatter plot showing the relationship between study hours and exam scores
Which Pandas method provides quick statistical information about the DataFrame?
.describe()
An elif statement is the required first conditional statement in every Python program.
False
random.randint(a, b) can return both endpoint values a and b.
True
In Python, the indentation and punctuation of a program are optional.
False
Outside a string literal, a hash symbol (#) begins a comment; Python ignores the text after it on that line.
True
A loop that never reaches a terminating condition can run indefinitely in a Jupyter Notebook.
True
Using too many colors can make a chart harder to read.
True
pd.read_csv() is a common method for loading CSV data into a DataFrame.
True
Pandas is widely used in fields that work with tabular or structured data.
True
Real-world data is always complete and error-free.
False
NumPy is a high-level, user-friendly interface whose main purpose is creating plots.
False
Find the errors and rewrite the code as a complete working program: score = input("enter your score: ") if score >= 70: print("Passed")
Two errors: input() returns a string (must use int()), and the print statement is not indented. Corrected code: score = int(input("Enter your score: "))\nif score >= 70:\n print("Passed")
Define a Pandas DataFrame. Then explain how the head() and tail() methods can be used to view its data.
A Pandas DataFrame is a labeled table with rows and columns.
head() shows the first few rows so you can preview the start of the data.
tail() shows the last few rows so you can check the end of the data.
Assume the user enters 7. What is the complete output of the code? Explain how the loop changes x and why it stops.
The loop starts at 7. It prints the number, then subtracts 2 each time. It stops when x becomes less than or equal to 0.