Question: What is a variable in Python?

Choices:
- A reserved word
- A data type
- A location in memory to store data
- A function


Question: How can you iterate over the items of a list using a while loop?

Choices:
- Use a for loop instead.
- Use the range function with the length of the list.
- Convert the list to a set and iterate over it.
- Use the enumerate function.


Question: In OOP, what is the benefit of using encapsulation?

Choices:
- Improved code organization
- Code reusability
- Enhanced code readability
- Increased system performance


Question: What is the purpose of the following list comprehension?numbers = [1, 2, 3, 4, 5]squared_odd_sum = [sum(x**2 for x in numbers) if sum(x for x in numbers) % 2 != 0 else x for x in numbers]

Choices:
- Squares all numbers in the list.
- Squares only odd numbers in the list.
- Squares the sum of odd numbers.
- Squares numbers based on the sum of all numbers.


Question: How does polymorphism contribute to code flexibility in OOP?

Choices:
- By combining multiple classes into one
- By providing a single interface for different types
- By restricting access to certain components of an object
- By defining multiple methods with the same name


Question: In OOP, what is an abstract class?

Choices:
- A class that cannot be instantiated
- A class that can be instantiated but not inherited
- A class that defines abstract methods and may have concrete methods
- A class that cannot have any methods


Question: Which deep learning architecture is widely used in natural language processing and involves attention mechanisms?

Choices:
- Recurrent Neural Network (RNN)
- Long Short-Term Memory (LSTM)
- Transformer
- Convolutional Neural Network (CNN)


Question: In Python's NLTK library, what function is used for stop word removal?

Choices:
- remove_stopwords()
- nltk.remove_stopwords()
- stopwords.remove()
- nltk.corpus.stopwords.words()


Question: What role do pre-trained language models like GPT-3 play in NLP tasks?

Choices:
- They eliminate the need for labeled training data
- They enhance model interpretability
- They optimize hyperparameter tuning
- They leverage knowledge learned from large corpora to improve performance


Question: In Python's spaCy library, what method is used for tokenization?

Choices:
- tokenize_text()
- nlp.tokenize()
- spacy.tokenize()
- nlp()


Question: What is the purpose of the fit_transform method in Scikit-learn's CountVectorizer class?

Choices:
- Tokenization
- Feature extraction
- Model training
- Text summarization


Question: What does the locals() function return in Python?

Choices:
- All global variables
- All local variables
- Both global and local variables
- The current namespace


Question: What is the purpose of the __init__ method in Python classes?

Choices:
- To initialize the class object
- To create a new instance of the class
- To define class variables
- To destroy the class object


Question: How can you access the value of a variable from an outer (non-global) scope in Python?

Choices:
- Using the outer keyword
- Using the enclosing keyword
- Using the nonlocal keyword
- It is not possible


Question: What is the output of the following code?x = 10def func():   x = 5   print(x)func()print(x)

Choices:
- 10
- 5
- 15
- Error


Question: What will happen if a variable with the same name is defined both locally and globally in Python?

Choices:
- The local variable takes precedence
- The global variable takes precedence
- It will result in an error
- Both variables can be used interchangeably


Question: What is a global namespace in Python?

Choices:
- The namespace of a function
- The namespace of a module
- The namespace of a class
- The namespace of an instance


Question: Which of the following statements is true regarding the scope of a variable in Python?

Choices:
- Local variables can be accessed globally.
- Global variables can be accessed only within the function they are defined.
- Local variables override global variables with the same name.
- Global variables always take precedence over local variables.


Question: What is the lifetime of a local variable in Python?

Choices:
- Until the program ends
- Until the function it is defined in ends
- Throughout the entire program
- Until explicitly deleted using del keyword


Question: In Python, what is the scope of a variable declared inside a function?

Choices:
- Global scope
- Local scope
- Module scope
- Class scope


Question: What is the primary purpose of namespaces in Python?

Choices:
- To organize code into modules
- To avoid naming conflicts and collisions
- To define global variables
- To enhance code readability


Question: What is the purpose of the __init__ method in a Python class?

Choices:
- Initializing class variables
- Declaring instance variables
- Defining methods for the class
- Creating a new class


Question: How can you implement encapsulation in Python?

Choices:
- By using private variables and methods
- By defining multiple methods with the same name in a class
- By creating a new instance of a class
- By using the @property decorator


Question: What is the purpose of the __str__ method in Python?

Choices:
- To convert an object to a string representation
- To define abstract methods in a class
- To perform cleanup activities when an object is no longer needed
- To initialize instance variables


Question: How can you create an abstract class in Python using the abc module?

Choices:
- By using the abstract keyword
- By defining methods with the @abstractmethod decorator
- By using the abstract attribute in the class definition
- By creating a class with no concrete methods


Question: What is the purpose of the @property decorator in Python?

Choices:
- To define class properties
- To create read-only properties
- To create write-only properties
- To create class methods


Question: How can you achieve method overloading in Python?

Choices:
- By defining multiple methods with the same name in a class
- By using the @overload decorator
- By using the super() function
- By defining multiple methods with the same parameters in a class


Question: What is a metaclass in Python?

Choices:
- A class that inherits from multiple classes
- A class for creating classes
- A class that cannot be instantiated
- A class that overrides all methods in a superclass


Question: How can you capture a group of characters in RegEx for later use?

Choices:
- (group)
- {group}
- [group]
- <group>


Question: Which character is used to match any whitespace character in RegEx?

Choices:
- \s
- \S
- \w
- \W


Question: Which function is used to check if a string starts with a specified pattern using RegEx?

Choices:
- startswith()
- beginswith()
- matchstart()
- patternstart()


Question: What does the "re.split()" method do in Python RegEx?

Choices:
- Matches a pattern anywhere in the string
- Splits a string based on a pattern
- Returns the first occurrence of a pattern
- Performs a case-sensitive search


Question: Which method is used to check if a pattern is present at the beginning of a string using RegEx?

Choices:
- matchstart()
- startswith()
- findstart()
- match()


Question: What does the "re.DEBUG" flag do in Python RegEx?

Choices:
- Enables debug mode
- Disables debug mode
- Prints debugging information
- Compiles patterns faster


Question: What does the "re.fullmatch()" method do in Python RegEx?

Choices:
- Matches a pattern anywhere in the string
- Matches the entire string against a pattern
- Returns the first occurrence of a pattern
- Performs a case-sensitive search


Question: Which method is used to split a string using a RegEx pattern in Python?

Choices:
- split()
- divide()
- break()
- slice()


Question: Q10-What is the scope of a variable in Python?

Choices:
- A. The scope of a variable is the range of values it can take.
- B. The scope of a variable is the length of the code file where it is defined.
- C. The scope of a variable is the part of the program where the variable can be accessed.
- D. The scope of a variable is the lifetime of the program.


Question: Q9-In Python, variable names are case-sensitive. What does this mean?

Choices:
- A. Variable names cannot contain uppercase letters.
- B. Variable names must always start with an uppercase letter.
- C. Variable names can be written using a mix of uppercase and lowercase letters, and these are considered distinct.
- D. Variable names must be entirely in uppercase.


Question: Q8-What does the strip() method do when applied to a Python string?

Choices:
- A. Removes leading and trailing whitespaces
- B. Converts the string to uppercase
- C. Extracts a substring based on specified indices
- D. Replaces a specified substring with another


Question: Q7-Which of the following methods is used to find the index of the first occurrence of a substring in a Python string if not found return -1 ?

Choices:
- A. find()
- B. index()
- C. search()
- D. locate()


Question: Q6-What will be the result of the following expression in Python: float("3.14")?

Choices:
- A. 3.14
- B. "3.14"
- C. 3
- D. 4


Question: What does the "re.IGNORECASE" flag do in Python RegEx?

Choices:
- Enables case-sensitive mode
- Disables case-sensitive mode
- Matches Unicode characters
- Ignores case


Question: Q5-Which function is used for converting a value to an integer in Python?

Choices:
- A. int()
- B. float()
- C. str()
- D. bool()


Question: Q3-What does the // operator do in Python?

Choices:
- A. Exponentiation
- B. Floor division
- C. Modulus
- D. Bitwise AND


Question: Q2-Which of the following is an example of a mutable data type in Python?

Choices:
- A. Tuple
- B. String
- C. Integer
- D. List


Question: Q1-What is the primary purpose of the Python set data type?

Choices:
- A. To store an ordered sequence of elements.
- B. To represent a collection of key-value pairs.
- C. To store unique and unordered elements.
- D. To define and store a fixed-size array.


Question: What is the purpose of the else clause in a try-except block in Python?

Choices:
- To define a function
- To execute code only if an exception occurs
- To execute code regardless of whether an exception occurs or not
- To create a loop


Question: What is the purpose of the is keyword in Python?

Choices:
- Checks if two objects are identical
- Checks if two objects have the same value
- Converts a string to uppercase
- Checks if an object is iterable


Question: In RegEx, what does the "\s" pattern represent?

Choices:
- Space character
- Any character
- Special character
- Non-space character


Question: What is the output of the following code snippet?def function(x):   return x * 3numbers = [1, 2, 3, 4, 5]result = list(map(lambda num: function(num), numbers))print(result)

Choices:
- [1, 2, 3, 4, 5]
- [3, 6, 9, 12, 15]
- [1, 3, 9, 16, 25]
- [3, 4, 5, 6, 7]


Question: What is the purpose of the filter function in Python?

Choices:
- Applies a function to each element in an iterable
- Removes elements from an iterable based on a condition
- Combines elements from multiple iterables
- Sorts elements in ascending order


Question: What is the output of the following code snippet?x = 5if x > 0:   print("Positive")elif x < 0:   print("Negative")else:   print("Zero")

Choices:
- Positive
- Negative
- Zero
- Error


Question: What is the purpose of the lambda keyword in Python?

Choices:
- Declares a function
- Raises an exception
- Defines a class
- Exits a loop


Question: Q4-Which operator is used for exponentiation in Python?

Choices:
- A. ^
- B. **
- C. %
- D. /


Question: Which method is used to check if a pattern is present anywhere in a string using RegEx?

Choices:
- search()
- match()
- find()
- locate()


Question: How can you match a word that ends with "py" in RegEx?

Choices:
- py$
- \bpy
- py\b
- ^py


Question: How can you make a RegEx pattern match across multiple lines in Python?

Choices:
- re.MULTILINE
- re.SINGLELINE
- re.LINEALL
- re.GLOBAL


Question: What is the time complexity of inserting an element into a heap?

Choices:
- O(log n)
- O(n)
- O(1)
- O(n log n)


Question: Which of the following is the correct way to create a heap in Python?

Choices:
- heap = []
- heap = [1, 2, 3, 4]
- from heapq import heapify; heapify([1, 2, 3, 4])
- heap = {1: 'a', 2: 'b', 3: 'c'}


Question: What is a heap?

Choices:
- A data structure that stores data in a binary tree structure
- A collection of data elements stored in an unordered manner
- A stack data structure with additional constraints
- A sorted collection of data elements


Question: Which of the following is the correct syntax for a ternary conditional expression in Python?

Choices:
- result if condition else result
- if condition then result else result
- result else condition then result
- if condition result else result


Question: Which of the following statements is true about the elif keyword in Python?

Choices:
- It is short for "else if"
- It is used to declare a variable
- It is only used in loops
- It indicates the end of a function


Question: What is the purpose of the super function in Python?

Choices:
- Calls a superclass constructor
- Converts a string to lowercase
- Checks if a number is even
- Exits a loop prematurely


Question: What is the purpose of the isinstance function in Python?

Choices:
- Checks if an object is an instance of a specified class
- Converts a string to lowercase
- Removes whitespace from a string
- Checks if a number is even


Question: What is the purpose of the del statement in Python?

Choices:
- Deletes a file from the filesystem
- Removes an element from a list by value
- Removes an attribute from an object
- Exits the program


Question: Which of the following statements is true about the try-except-else block in Python?

Choices:
- The else block is executed only if an exception occurs
- The try block is mandatory, but the except block is optional
- The else block is executed only if no exception occurs
- The else block is used to raise an exception


Question: Which of the following is true about the global keyword in Python?

Choices:
- Used to declare a global variable within a function
- Used to define a global function
- Used to access a variable from another module
- Used to declare a constant variable


Question: What does the pass statement do in Python?

Choices:
- Exits the program
- Skips the current iteration of a loop
- Raises an exception
- Continues to the next block of code


Question: What is the output of the following code snippet?def function(x):   return x % 2 == 0numbers = [1, 2, 3, 4, 5]result = list(filter(function, numbers))print(result)

Choices:
- [1, 3, 5]
- [2, 4]
- [1, 2, 3, 4, 5]
- [2]


Question: What is the purpose of the chr function in Python?

Choices:
- Converts an integer to a character
- Converts a character to an integer
- Converts a string to uppercase
- Checks if a number is even


Question: In Python, what is the purpose of the property() function?

Choices:
- To define a class property
- To access global variables
- To create a new property
- To define a method as a property


Question: What is the purpose of the 'staticmethod' decorator in Python?

Choices:
- To define a static method in a class
- To access global variables
- To create a static variable
- To declare a method as static


Question: How can you access a global variable from within a function in Python?

Choices:
- Use the access keyword
- Use the global keyword
- Use the outer keyword
- Use the variable name directly


Question: What is the purpose of the dir() function in Python?

Choices:
- Returns a list of all global variables
- Returns a list of all local variables
- Returns a list of names in the current namespace
- Returns a list of all functions in the current module


Question: What is the purpose of the threading module in Python?

Choices:
- To create threads and implement multithreading
- To access global variables
- To define class variables
- To create thread-safe functions


Question: What is the purpose of the __dict__ attribute in Python?

Choices:
- To access the dictionary of a list
- To access the dictionary of a class or module
- To define a dictionary in Python
- To convert a dictionary to a list


Question: How do you create a dictionary using a comprehension in Python?

Choices:
- {key: value for key, value in iterable}
- dict(iterable)
- create_dict(iterable)
- {key, value in iterable}


Question: How do you create a multiline string in Python?

Choices:
- "This is a multiline string"
- 'This is a multiline string'
- """This is a multiline string"""
- (a and b)


Question: How do you convert a floating-point number to an integer in Python?

Choices:
- int(number)
- float_to_int(number)
- number.int()
- convert(int, number)


Question: How do you find the length of a list in Python?

Choices:
- len(list)
- length(list)
- list.length()
- count(list)


Question: What is the purpose of the all function in Python?

Choices:
- Checks if all elements in an iterable are true
- Checks if any element in an iterable is true
- Converts an iterable into a list
- Checks if all elements in an iterable are false


Question: What is the purpose of the else clause in a try-except block in Python?

Choices:
- To define a function
- To execute code only if an exception occurs
- To execute code regardless of whether an exception occurs or not
- To create a loop


Question: Which of the following statements is true about decorators in Python?

Choices:
- Decorators are used to create new classes
- Decorators cannot be nested
- Decorators modify the behavior of functions or methods
- Decorators are applied only to built-in functions


Question: What is the purpose of the 'a+U' mode in file opening?

Choices:
- Append and Unicode support
- Access and Universal newline support
- Add and Update
- Append and Update


Question: How can list comprehension be used to create a list of tuples?

Choices:
- By converting a list to a tuple after using list comprehension.
- By using the tuple() constructor within the list comprehension.
- List comprehension can only create lists, not tuples.
- By enclosing each element in parentheses within the list comprehension.


Question: Can list comprehension be used with other data types besides lists?

Choices:
- No, it can only be used with lists.
- Yes, it can be used with any iterable.
- Yes, but only with strings.
- No, it is limited to numerical data types.


Question: What is the role of the __metaclass__ attribute in Python?

Choices:
- To define class properties
- To specify the superclass of a class
- To indicate the metaclass of a class
- To restrict the creation of new attributes in an instance


Question: In the context of encapsulation, what is the purpose of access modifiers in Python?

Choices:
- To define class properties
- To restrict access to certain components of an object
- To create read-only propertiesD) To initialize instance variables
- To initialize instance variables


Question: What is dynamic polymorphism in OOP?

Choices:
- The ability to create objects at runtime
- The ability to change the type of a variable dynamically
- The ability to provide a single interface for different types at runtime
- The ability to define methods with different names in a class


Question: What does the try-except-else block do in Python?

Choices:
- Handles exceptions and executes code if no exception occurs
- Defines a loop with exception handling
- Checks multiple conditions and executes code if the conditions are met
- Exits the program


Question: How does encapsulation contribute to data protection in OOP?

Choices:
- By exposing all class attributes publicly
- By allowing direct access to private attributes
- By restricting access to certain components of an object
- By promoting global access to class members


Question: How do you convert a list of strings to a single string in Python?

Choices:
- "".join(list)
- str(list)
- convert(list, str)
- " ".join(list)


Question: What is the output of the following code?x = [1, 2, 3, 4]y = filter(lambda a: a % 2 == 0, x)print(list(y))

Choices:
- [1, 3]
- [2, 4]
- [1, 2, 3, 4]


Question: What is the purpose of the enumerate() function in Python?

Choices:
- To get the index and value of each item in an iterable
- To count the occurrences of an element in an iterable
- To enumerate through a list
- To enumerate through a dictionary


Question: How do you check if a key is present in a dictionary?

Choices:
- key in dictionary
- key.exists(dictionary)
- dictionary.contains(key)
- has_key(key, dictionary)


Question: How do you find the length of a list in Python?

Choices:
- len(list)
- length(list)
- list.length()
- count(list)


Question: What is the purpose of the max() function in Python?

Choices:
- To find the maximum value in a list
- To get the maximum length of a string
- To compare two variables
- To find the maximum of two numbers


Question: What is the output of the following code?x = "Hello"print(x[1:4])

Choices:
- "Hell"
- "ello"
- "ell"
- Error


Question: How do you concatenate two strings in Python?

Choices:
- str1 . str2
- str1 + str2
- str1 , str2
- concat(str1, str2)


Question: What is the output of the following code?x = 5y = 2print(x // y)

Choices:
- 2.5
- 2
- 2.0
- 3


Question: What is the correct way to check if a variable is of a specific type in Python?

Choices:
- type(var) == "int"
- var.type() == "int"
- isinstance(var, int)
- var.isint()


Question: What is the purpose of the enumerate function in a for loop?

Choices:
- To create an enumerated list
- To generate a sequence of numbers
- To iterate over two lists simultaneously
- To access both the index and the value of elements in an iterable


Question: How can you iterate over a string in reverse order using a for loop?

Choices:
- for char in reversed(string):
- for char in string[::-1]:
- for char in string.reverse():
- Reverse iteration is not possible on strings


Question: What will the following code output?numbers = [3, 7, 2, 8, 5]for i, num in enumerate(numbers):   if i == num:       break   print(num, end=' ')

Choices:
- 3 7 2 8 5
- 3 7
- 3 7 2
- 7 2 8


Question: How can you iterate over the elements of multiple lists simultaneously using a for loop?

Choices:
- for a, b in zip(list1, list2):
- for a, b in enumerate(list1, list2):
- for a in list1 and for b in list
- Simultaneous iteration is not possible in Python


Question: What is the purpose of the else clause in a for loop?

Choices:
- To execute an alternative block of code
- To handle exceptions
- To specify the step size of the loop
- To execute code when the loop is terminated normally


Question: In RegEx, what does the "(?<=...)" construct represent?

Choices:
- Positive lookahead
- Positive lookbehind
- Negative lookahead
- Negative lookbehind


Question: What is the significance of the order of for clauses in nested list comprehensions?

Choices:
- The order has no effect on the result.
- It determines the order of elements in the resulting list.
- It is not possible to have multiple for clauses in list comprehension.
- It only affects the readability of the code.


Question: What will the following list comprehension output?words = ['apple', 'banana', 'cherry']word_lengths = {word: len(word) for word in words if len(word) % 2 == 0}

Choices:
- {'apple': 5, 'banana': 6, 'cherry': 6}
- {'apple': 5, 'banana': 6}
- {'apple': 5, 'cherry': 6}
- {'banana': 6, 'cherry': 6}


Question: What is the primary purpose of multiple inheritance in OOP?

Choices:
- To create complex class hierarchies
- To combine attributes from multiple classes
- To allow a class to inherit from more than one superclass
- To override methods in multiple classes


Question: What is the purpose of the nonlocal keyword in Python?

Choices:
- To declare a variable as non-local
- To access a variable from the global scope
- To declare a variable as local
- To access a variable from an enclosing (non-global) scope


Question: What is the purpose of the __call__ method in Python?

Choices:
- To call a function
- To make an instance callable
- To define class variables
- To create a callable object


Question: What is the output of the following code?x = 10def func():   global x   x = 5   print(x)func()print(x)

Choices:
- 10
- 5
- 15
- Error


Question: What is the purpose of the __file__ attribute in Python?

Choices:
- To get the name of the module
- To get the path of the module's source file
- To get the creation date of the module
- To get the size of the module


Question: Which of the following is not a valid variable name in Python?

Choices:
- my_variable
- 1variable
- _variable
- variable_1


Question: What is the purpose of the __all__ attribute in Python?

Choices:
- To define all global variables
- To specify which names should be imported when using from module import *
- To list all local variables
- To declare all class attributes


Question: In Python, what is the purpose of the super() function?

Choices:
- To call a method in the parent class
- To create a superclass
- To access global variables
- To declare a variable as super


Question: Which of the following is true regarding the __main__ block in Python?

Choices:
- It is executed when the program is imported as a module
- It is executed when the program is run as the main program
- It is used to define main functions
- It is executed when a function is defined


Question: Which method is used to write a sequence of strings to a file in Python?

Choices:
- file.write_lines()
- write_sequence(file, sequence)
- file.writelines(sequence)
- write_to_file(file, sequence)


Question: What is the purpose of the 'r+U' mode in file opening?

Choices:
- Read and Universal newline support
- Read and Update
- Replace and Update
- Read and Unique support


Question: How can you read a specific line containing a keyword from a file in Python?

Choices:
- file.read_line_with_keyword(keyword)
- read_line_with_keyword(file, keyword)
- file.read_line(keyword)
- read_keyword_line(file, keyword)


Question: How can you read a specific section of a file in Python?

Choices:
- file.read_section(start, end)
- read_file_section(file, start, end)
- file.read(start, end)
- read_section(file, start, end)


Question: Which of the following is an immutable data type in Python?

Choices:
- List
- Tuple
- Set
- Dictionary


Question: What is the purpose of the functools.partial function in Python?

Choices:
- To define a partial function
- To create a function with fixed arguments
- To access global variables
- To define a function with default arguments


Question: In what scenarios might it be better to use traditional loops instead of list comprehension?

Choices:
- When the code needs to be more concise.
- When the logic involves complex conditions.
- In situations where performance is critical.
- List comprehension is always preferable.


Question: What is the purpose of the apply() function in R?

Choices:
- Applying a mathematical function to a vector
- Applying a function to each element of an array
- Applying a conditional statement to a data frame
- Applying a regression model


Question: In R, what is the purpose of the summary() function when applied to a linear regression model created with lm()?

Choices:
- Displays a summary of the model's coefficients
- Displays a summary of the model's residuals
- Provides a summary of the model's performance metrics
- Presents an overview of the model's input features


Question: In R, what is the purpose of the `purrr` package's `map()` function?**

Choices:
- Applies a function to each element of a vector and returns a list
- Applies a function to each row of a data frame and returns a vector
- Applies a function to each element of a list and returns a list of results
- Applies a function to each column of a matrix and returns a matrix


Question: What does the following R code do?df <- data.frame(name = c("Alice", "Bob", "Charlie"),                age = c(25, 30, 22))

Choices:
- Creates a matrix with two columns: "name" and "age"
- Creates a data frame with two columns: "name" and "age"
- Creates a list with two elements: "name" and "age"
- Raises an error due to incorrect syntax


Question: What does the following R code do?x <- c(1, 2, 3, 4, 5)y <- sum(x)

Choices:
- Creates a vector x with values 1 to 5
- Calculates the mean of vector x
- Calculates the sum of vector x
- Raises each element of vector x to the power of 2


Question: How can you perform linear regression in R using the lm() function?

Choices:
- mice.impute()
- impute.data()
- mice()
- mice::complete()


Question: How do you assign a value to a variable in R?

Choices:
- x = 5
- x <- 5
- x := 5
- x >- 5


Question: What is the purpose of the strsplit() function in R?

Choices:
- Splits a string into substrings based on a specified delimiter
- Concatenates strings into a single string
- Reverses the order of characters in a string
- Extracts a substring from a string


Question: In R, what does the dendrogram class represent in hierarchical clustering?

Choices:
- A scatter plot of data points
- A matrix of distances between data points
- A tree-like structure representing the clustering hierarchy
- A network graph of relationships between variables


Question: In R, what does the mutate() function from the dplyr package do?

Choices:
- Adds new variables or modifies existing ones in a data frame
- Performs matrix multiplication
- Mutates the entire data frame
- Deletes variables from a data frame


Question: In R, what does the lapply() function do?

Choices:
- Applies a function to each element of a list and returns a list of the results
- Applies a function to each element of a vector and returns a vector
- Applies a function to each column of a data frame and returns a list of the results
- Applies a function to each row of a matrix and returns a list of the results


Question: How can you create a time series plot in R using ggplot2 for a specific variable in a data frame?

Choices:
- plot(df$variable, type = "ts")
- ggplot(data = df, aes(x = date, y = variable)) + geom_line()
- ts_plot(df, variable)
- time_series(df, variable)


Question: How can you perform a left join between two data frames in R using the dplyr package?

Choices:
- merge(df1, df2, by = "key", all.x = TRUE)
- left_join(df1, df2, by = "key")
- join(df1, df2, by = "key", type = "left")
- left_merge(df1, df2, by = "key")


Question: How can you rename a column in a data frame in R?

Choices:
- rename_column(df, old_name, new_name)
- change_column_name(df, old_name, new_name)
- colnames(df)[colnames(df) == "old_name"] <- "new_name"
- update_column(df, old_name, new_name)


Question: What is the purpose of the dplyr package in R?

Choices:
- Data visualization
- Data manipulation
- Statistical modeling
- Time series analysis


Question: What does the length() function return for a vector in R?

Choices:
- The number of rows
- The number of columns
- The total number of elements
- The mean of the vector


Question: How do you comment a single line in an R script?


Question: How can you create a vector of integers from 1 to 10 in R?

Choices:
- vector(1:10)
- seq(1, 10)
- 1:10
- range(1, 10)


Question: How can you check if a variable is NULL in R?

Choices:
- isnull(x)
- is.null(x)
- null(x)
- check.null(x)


Question: How can you read a CSV file into a data frame in R?

Choices:
- read.csv()
- read.table()
- load.csv()
- import.table()


Question: What does the summary() function provide for a statistical analysis in R?

Choices:
- Descriptive statistics
- Inferential statistics
- Predictive modeling
- Time series analysis


Question: Which function is used to create a sequence of numbers in R?

Choices:
- seq()
- range()
- create()
- numbers()


Question: What function is used to check the structure of an R object?

Choices:
- info()
- str()
- check()
- view()


Question: Which function is used to generate random numbers from a normal distribution in R?

Choices:
- random.normal()
- rnorm()
- randn()
- normrnd()


Question: What is the purpose of the `reshape2` package's `melt()` function in R?**

Choices:
- Melts a data frame from wide to long format
- Casts a data frame from long to wide format
- Reshapes a data frame by merging columns
- Applies a function to each element of a matrix