Blog

MCQs

Disclaimer:

Educational Use Only:

The website links provided are to be used strictly for educational and knowledge-gaining purposes only.

No Misuse:

Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.

Respect for Websites and Businesses:

Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.

Acknowledge Value of Knowledge:

Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.

No Endorsement:

The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.

User Responsibility:

By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.


Overall MCQs for Reference

  1. Which library provides DataFrame structure in Python?
    a. Numpy
    b. Pandas
    c. Matplotlib
    d. Scikit-learn
    Answer: b. Pandasrfaqs+1​
  2. What is the function to create a DataFrame from a dictionary in Pandas?
    a. pd.create()
    b. pd.DataFrame()
    c. pd.make_df()
    d. pd.df()
    Answer: b. pd.DataFrame()w3schools+1​
  3. A DataFrame in R is created using which function?
    a. array()
    b. data.frame()
    c. vector()
    d. list()
    Answer: b. data.frame()rfaqs+1​
  4. Which of the following can NOT be a column in a DataFrame?
    a. Numeric values
    b. Strings
    c. Functions
    d. Boolean values
    Answer: c. Functionsdatabricks+1​
  5. In Pandas, which attribute is used to get the column labels of a DataFrame?
    a. columns
    b. labels
    c. fields
    d. names
    Answer: a. columnsgeeksforgeeks+1​
  6. How do you select the first 5 rows of a DataFrame “df”?
    a. df.head(5)
    b. df.first(5)
    c. df.get(5)
    d. df.top(5)
    Answer: a. df.head(5)w3schools+1​
  7. Which method removes duplicate rows from a DataFrame in Pandas?
    a. remove_duplicates()
    b. drop_duplicates()
    c. delete_duplicates()
    d. unique_rows()
    Answer: b. drop_duplicates()rfaqs+1​
  8. Which of the following can be used as an index in a DataFrame?
    a. Only integers
    b. Only strings
    c. Any hashable type
    d. Only rows
    Answer: c. Any hashable typegeeksforgeeks+1​
  9. What does the shape attribute of a DataFrame return?
    a. Size of DataFrame
    b. Number of columns
    c. Tuple (rows, columns)
    d. Number of cells
    Answer: c. Tuple (rows, columns)w3schools+1​
  10. In R, to display the first few rows of a data frame, which function is used?
    a. top()
    b. head()
    c. start()
    d. first()
    Answer: b. head()placementpreparation+1​
  11. Which attribute returns a NumPy array of DataFrame values?
    a. .values
    b. .elements
    c. .array
    d. .records
    Answer: a. .valuesgeeksforgeeks+1​
  12. A DataFrame can be created from which data structure(s)?
    a. List
    b. Dictionary
    c. Numpy array
    d. All of the above
    Answer: d. All of the abovestudytrigger+1​
  13. What is the default axis for drop() method to remove columns in Pandas?
    a. 0
    b. 1
    c. “columns”
    d. “col”
    Answer: b. 1w3resource+1​
  14. How can you get summary statistics for numeric columns in Pandas?
    a. info()
    b. summary()
    c. describe()
    d. summarize()
    Answer: c. describe()rfaqs+1​
  15. Which function in R is used to check the structure of a DataFrame?
    a. check()
    b. structure()
    c. str()
    d. inf()
    Answer: c. str()rfaqs+1​
  16. How can a DataFrame be transposed in Pandas?
    a. df.transpose()
    b. df.T
    c. Both a and b
    d. Not possible
    Answer: c. Both a and bw3schools+1​
  17. In Pandas, which method is used to read data from a CSV file?
    a. read_csv()
    b. get_csv()
    c. load_csv()
    d. import_csv()
    Answer: a. read_csv()geeksforgeeks+1​
  18. Which method writes a DataFrame into an Excel file?
    a. to_csv()
    b. to_excel()
    c. save_excel()
    d. write_excel()
    Answer: b. to_excel()w3schools+1​
  19. What datatype is returned by df[‘column’] in Pandas?
    a. DataFrame
    b. Series
    c. Array
    d. List
    Answer: b. Seriesrfaqs+1​
  20. Which of the following is NOT an aggregation function in Pandas?
    a. sum()
    b. mean()
    c. aggregate()
    d. describe()
    Answer: d. describe()geeksforgeeks+1​
  21. In R, to access a column named “age” from data frame df, which syntax is valid?
    a. df$age
    b. df[age]
    c. df{age}
    d. df#age
    Answer: a. df$ageplacementpreparation+1​
  22. How do you rename a column in Pandas?
    a. df.rename(columns={‘old’: ‘new’})
    b. df.change(columns={‘old’:’new’})
    c. df.edit(columns={‘old’:’new’})
    d. df.update(columns={‘old’:’new’})
    Answer: a. df.rename(columns={‘old’: ‘new’})w3schools+1​
  23. D1[ : ] = 77 will set values of a Data Frame ‘D1’ to 77:
    a. Only First Row
    b. Only First Column
    c. All
    d. None of the above
    Answer: c. Allcsiplearninghub​
  24. Assigning D1[‘Rollno’] = when column already exists:learnpython4cbse+2​
    a. Return error
    b. Replace the already existing values
    c. Add new column
    d. None of the above
    Answer: b. Replace the already existing valuescsiplearninghub​
  25. What will D1[‘Rollno’] = 11 do in Pandas?
    a. Return error
    b. Change all values of column Roll numbers to 11
    c. Add new column
    d. None of the above
    Answer: b. Change all values of column Roll numbers to 11csiplearninghub​
  26. Which function is used to concatenate two DataFrames in Pandas by rows?
    a. union()
    b. append()
    c. concat()
    d. connect()
    Answer: c. concat()geeksforgeeks+1​
  27. In R, which method checks for missing (NA) values in a DataFrame?
    a. has_na()
    b. missing()
    c. is.na()
    d. null()
    Answer: c. is.na()rfaqs+1​
  28. The to_dict() method in Pandas converts a DataFrame:
    a. To list
    b. To dictionary
    c. To array
    d. To string
    Answer: b. To dictionaryw3schools+1​
  29. Which function is used to fill NA/null values in a DataFrame?
    a. fillna()
    b. maskna()
    c. setna()
    d. replace()
    Answer: a. fillna()geeksforgeeks+1​
  30. How to select rows where column “A” equals 5 in Pandas DataFrame df?
    a. df[df.A == 5]
    b. df(select=A==5)
    c. df.row(A=5)
    d. df.filter(‘A’==5)
    Answer: a. df[df.A == 5]w3schools+1​
  31. What is the output type of DataFrame.info()?
    a. DataFrame
    b. Dictionary
    c. None
    d. Prints summary
    Answer: d. Prints summarygeeksforgeeks+1​
  32. The default join method in pd.merge() is:
    a. Inner
    b. Outer
    c. Left
    d. Right
    Answer: a. Innerw3schools+1​
  33. Which method is used for grouping DataFrame rows in Pandas?
    a. group()
    b. groups()
    c. groupby()
    d. categorize()
    Answer: c. groupby()geeksforgeeks+1​
  34. In R, you can combine two data frames using:
    a. merge()
    b. attach()
    c. combine()
    d. cbind()
    Answer: a. merge()placementpreparation+1​
  35. How can you reset the index of a Pandas DataFrame?
    a. reset_index()
    b. set_index()
    c. index_reset()
    d. change_index()
    Answer: a. reset_index()w3schools+1​
  36. Which function finds unique values in a column?
    a. unique()
    b. uniq()
    c. values()
    d. singles()
    Answer: a. unique()rfaqs+1​
  37. In Pandas, pivot tables are created using:
    a. create_pivot()
    b. pivot_table()
    c. pivotable()
    d. table_pivot()
    Answer: b. pivot_table()geeksforgeeks+1​
  38. Which method is used to filter rows based on a Boolean mask?
    a. filter()
    b. mask()
    c. where()
    d. None of the above
    Answer: c. where()w3schools+1​
  39. In R, which function accesses column names of a DataFrame?
    a. colnames()
    b. header()
    c. names()
    d. columns()
    Answer: a. colnames()rfaqs+1​
  40. Which parameter of read_csv() sets the first column as index?
    a. index
    b. first_col
    c. index_col
    d. indexfirst
    Answer: c. index_colgeeksforgeeks+1​
  41. What does the iloc method do in Pandas?
    a. Index by labels
    b. Integer-location based indexing
    c. Search for items
    d. None of the above
    Answer: b. Integer-location based indexingw3schools+1​
  42. Which function displays last 3 rows of DataFrame df?
    a. df.tail(3)
    b. df.end(3)
    c. df.last(3)
    d. df.bottom(3)
    Answer: a. df.tail(3)geeksforgeeks+1​
  43. Which argument of pd.concat() stacks dataframes horizontally?
    a. axis=0
    b. axis=1
    c. horizontal=True
    d. stack=’h’
    Answer: b. axis=1w3schools+1​
  44. Which Pandas method can change the order of columns?
    a. reindex()
    b. reorder()
    c. change_order()
    d. columns_change()
    Answer: a. reindex()geeksforgeeks+1​
  45. In which language can DataFrames span across distributed systems?
    a. Python only
    b. R only
    c. Scala only
    d. All listed
    Answer: d. All listedprophecy+1​
  46. Which of the following is NOT a feature of DataFrame in R?
    a. Supports columns of different types
    b. Stores data in tabular form
    c. Only supports numeric types
    d. Integrates with ggplot2
    Answer: c. Only supports numeric typesrfaqs​
  47. How to delete a column “Age” from DataFrame df in Pandas?
    a. del df[‘Age’]
    b. drop(df[‘Age’])
    c. remove(df[‘Age’])
    d. pop(df[‘Age’])
    Answer: a. del df[‘Age’]w3schools+1​
  48. What is the result of df.shape if df has 8 rows and 4 columns?
    a. (8, 4)
    b. (4, 8)
    c. 8
    d. 4
    Answer: a. (8, 4)geeksforgeeks+1​
  49. Which method is used to iterate over DataFrame rows as (index, Series) pairs?
    a. iterrows()
    b. rows()
    c. enumerate()
    d. itertuples()
    Answer: a. iterrows()w3schools+1​
  50. The melt() function in Pandas is primarily used for:
    a. Aggregating data
    b. Reshaping DataFrame to long format
    c. Exporting data
    d. Cleaning missing data
    Answer: b. Reshaping DataFrame to long formatgeeksforgeeks+1​
  1. https://rfaqs.com/r-graphics/python-pandas-data-frame-mcqs-17/
  2. https://www.w3schools.com/datascience/ds_python_dataframe.asp
  3. https://www.geeksforgeeks.org/pandas/python-pandas-dataframe/
  4. https://rfaqs.com/data-structure/data-frame/
  5. https://www.placementpreparation.io/mcq/r-programming/
  6. https://www.databricks.com/glossary/what-are-dataframes
  7. https://www.prophecy.io/blog/what-are-dataframes
  8. https://www.studytrigger.com/article/dataframe-practice-questions-with-solutions-part-1/
  9. https://www.w3resource.com/python-exercises/pandas/index-dataframe.php
  10. https://csiplearninghub.com/python-dataframe-mcq-class-12-ip/
  11. https://www.learnpython4cbse.com/mcq-comp-sc-xii-16/python-mcq-pandas-dataframe-1
  12. https://www.sanfoundry.com/data-science-questions-answers-pandas-data-structure/
  13. https://www.sanfoundry.com/r-programming-questions-answers-data-types-5/
  14. https://www.scribd.com/document/561895270/Pandas-MCQ-Questions-with-Answers
  15. https://techtipnow.in/python-pandas-dataframe-mcq/
  16. https://www.geeksforgeeks.org/python/pandas-practice-excercises-questions-and-solutions/
  17. https://www.igmguru.com/blog/r-programming-mcqs
  18. https://www.scribd.com/document/661068607/DATAFRAME-PRACTICAL
  19. https://www.studocu.com/in/document/srm-institute-of-science-and-technology/data-science/data-science-question-bank-dataframe-operations-visualization-anomaly/127318999
  20. https://www.scribd.com/document/525393699/Dataframe-I

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!