

































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


































































Question 1. Which Python package is most commonly used to interact with the Leadscore.io REST API? A) pandas B) requests C) numpy D) matplotlib Answer: B Explanation: The requests library provides simple methods for sending HTTP GET/POST requests, which is essential for calling Leadscore.ioâs REST endpoints. Question 2. In Leadscore.io, a âleadâ is best described as: A) A marketing campaign B) A potential customer record with attributes and activity data C) A data visualization chart D) An email template Answer: B Explanation: Leadscore.io stores each prospect as a lead containing demographic, firmographic, and behavioral attributes used for scoring. Question 3. Which HTTP method should you use with the Leadscore.io API to retrieve a list of leads? A) POST B) PUT C) GET D) DELETE Answer: C
Explanation: GET requests are used to read data without modifying the server, such as fetching lead collections. Question 4. When authenticating to Leadscore.io API using an API key, the key should be placed in which part of the request? A) URL path B) Request body as JSON C) HTTP header named Authorization D) Cookie header Answer: C Explanation: API keys are typically sent in the Authorization header (e.g., Authorization: Bearer <API_KEY>). Question 5. Which of the following data structures is ideal for storing a leadâs list of tags (e.g., âwebinarâ, âebookâ) in Python? A) tuple B) list C) dict D) set Answer: D Explanation: A set automatically enforces uniqueness, which is appropriate for tags that should not repeat. Question 6. In pandas, which method would you use to read a CSV file exported from Leadscore.io? A) pd.read_excel() B) pd.read_json() C) pd.read_csv()
B) lxml C) html5lib D) xml.etree.ElementTree Answer: B Explanation: lxml is a fast, featureârich parser that handles malformed HTML better than the builtâin parser. Question 10. Which HTTP status code indicates that your request to Leadscore.io was successful and data was returned? A) 200 B) 201 C) 400 D) 401 Answer: A Explanation: 200 OK means the request succeeded and the server returned the requested resource. Question 11. In a Leadscore.io webhook payload, the field âevent_typeâ most likely contains: A) The leadâs email address B) The type of activity that triggered the webhook (e.g., âpage_viewâ) C) The API version number D) The database schema name Answer: B Explanation: Webhook payloads include an event_type to identify which action (click, form submit, etc.) caused the notification.
Question 12. Which Python keyword defines a function that can accept any number of positional arguments, useful when forwarding API parameters? A) *args B) **kwargs C) lambda D) yield Answer: A Explanation: *args collects extra positional arguments into a tuple, allowing flexible parameter passing. Question 13. To schedule a Python script that pulls daily lead data from Leadscore.io, which Linux utility would you use? A) crontab B) systemd C) at D) nohup Answer: A Explanation: crontab allows you to define recurring jobs (e.g., every day at 02:00) for script execution. Question 14. Which pandas method would you use to combine lead data (DataFrame A) with campaign performance data (DataFrame B) on the âcampaign_idâ column? A) concat() B) merge(on='campaign_id') C) join() D) append() Answer: B Explanation: merge() performs SQLâlike joins based on matching column values.
Answer: B Explanation: The with context manager guarantees that the file is closed when the block exits. Question 18. Which matplotlib function would you use to visualize the distribution of lead scores? A) plt.bar() B) plt.scatter() C) plt.hist() D) plt.pie() Answer: C Explanation: A histogram (plt.hist) shows frequency distribution of numeric values such as scores. Question 19. When performing an A/B test on two email subject lines, which statistical test is most appropriate for comparing conversion rates? A) Paired tâtest B) Chiâsquared test for independence C ANOVA D) Pearson correlation Answer: B Explanation: The chiâsquared test evaluates whether the observed conversion counts differ significantly between groups. Question 20. In a logistic regression model for lead conversion, the target variable should be coded as: A) Continuous values from 0 to 1 B) Integer counts of conversions C) Binary 0 (no conversion) or 1 (conversion)
D) Categorical strings âYesâ/âNoâ Answer: C Explanation: Logistic regression expects a binary numeric target to estimate conversion probability. Question 21. Which scikitâlearn class implements logistic regression? A) LinearRegression B) LogisticRegression C) DecisionTreeClassifier D) KMeans Answer: B Explanation: LogisticRegression fits a model for binary classification tasks like lead conversion. Question 22. In the context of lead scoring, the term âfeature engineeringâ refers to: A) Designing the UI of the scoring dashboard B) Creating new predictor variables from raw data (e.g., interaction counts) C) Writing unit tests for the scoring algorithm D) Deploying the model to production Answer: B Explanation: Feature engineering transforms raw attributes into informative inputs for the predictive model. Question 23. Which metric best captures the tradeâoff between true positives and false positives for a lead scoring model? A) Accuracy B) Mean Squared Error C) ROCâAUC
B) calendar C) datetime D) dateutil.parser Answer: C Explanation: datetime.strptime() parses formatted strings into datetime objects. Question 27. Which pandas function helps you fill missing numeric lead attributes with the column mean? A) fillna(method='ffill') B) replace(np.nan, 0) C) fillna(df.mean()) D) dropna() Answer: C Explanation: fillna(df.mean()) replaces NaNs with the mean value of each column. Question 28. In a Jupyter Notebook, which magic command lists all installed Python packages? A) %list_packages B) %pip list C) %conda info D) %show_env Answer: B Explanation: %pip list displays the current environmentâs installed packages. Question 29. Which of the following is a best practice when storing Leadscore.io API keys in a Python project? A) Hardâcode them in the script
B) Place them in a plainâtext .env file and load with python-dotenv C) Commit them to version control D) Encode them in base64 and store in the source code Answer: B Explanation: Using a .env file keeps secrets out of source code and can be ignored by Git. Question 30. To create a reusable function that fetches lead data for a given lead_id, which parameter type is most appropriate? A) positional only B) keyword only C) default argument with None D) variableâlength positional (*args) Answer: C Explanation: Providing a default None allows the function to be called without an ID, enabling optional behavior. Question 31. Which Python data type would you choose to store a leadâs âattributesâ JSON object after parsing? A) list B) tuple C) dict D) set Answer: C Explanation: JSON objects map directly to Python dictionaries, preserving keyâvalue pairs.
Question 35. Which scikitâlearn transformer is used to standardize numeric lead features before feeding them into a model? A) MinMaxScaler B) StandardScaler C) OneHotEncoder D) PCA Answer: B Explanation: StandardScaler centers data to mean 0 and unit variance, a common preprocessing step. Question 36. When performing KâMeans clustering on lead data, which metric determines the optimal number of clusters? A) Silhouette score B) Confusion matrix C) Râsquared D) AIC Answer: A Explanation: The silhouette score evaluates how well each point fits within its cluster, guiding the choice of k. Question 37. Which Python statement correctly imports the json module and aliases it as js? A) import json as js B) import js from json C) from json import js D) import json - > js Answer: A
Explanation: import json as js imports the module under a different name. Question 38. To concatenate two pandas DataFrames df1 and df2 vertically (adding rows), which function is used? A) pd.merge(df1, df2) B) pd.concat([df1, df2]) C) df1.append(df2) D) pd.join(df1, df2) Answer: B Explanation: pd.concat with a list of DataFrames stacks them along the default axis (rows). Question 39. Which of the following is a valid list comprehension that extracts lead IDs from a list of lead dictionaries leads? A) [lead['id'] for lead in leads] B) lead['id'] for lead in leads C) {lead['id'] for lead in leads} D) (lead.id for lead in leads) Answer: A Explanation: List comprehensions use square brackets and an for clause to build a new list. Question 40. When visualizing lead conversion over time with Matplotlib, which function sets the xâaxis to display dates nicely? A) plt.xticks(rotation=45) B) plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d')) C) plt.xlabel('Date') D) plt.plot_date()
D) lambda x: return x*x Answer: A Explanation: The lambda expression uses : to separate parameters from the expression; return is implicit. Question 44. To handle a large CSV export from Leadscore.io without loading it fully into memory, which pandas option is useful? A) chunksize parameter in read_csv() B) low_memory=False C) dtype=str D) usecols=None Answer: A Explanation: chunksize reads the file in iterable chunks, reducing memory consumption. Question 45. Which of the following is a correct way to catch and log an exception when a request to Leadscore.io fails? A) try: response = requests.get(url) except Exception as e: logger.error(e) B) if response.status_code != 200: raise C) response = requests.get(url) catch Exception: pass D) try: response = requests.get(url) finally: print('Done') Answer: A Explanation: The try/except block captures any exception; logging the error provides traceability. Question 46. When using pandas.concat() to combine DataFrames with different columns, the missing values are filled with: A) 0
B) NaN C) '' (empty string) D) - 1 Answer: B Explanation: Pandas inserts NaN for missing data when aligning columns. Question 47. In a logistic regression model, the probability output is obtained by applying which function to the linear combination of features? A) Softmax B) Sigmoid (logistic) function C) ReLU D) Tanh Answer: B Explanation: The sigmoid function maps any real number to a value between 0 and 1, representing probability. Question 48. Which Python builtâin function returns the number of items in a list of leads? A) size() B) length() C) len() D) count() Answer: C Explanation: len() returns the length of any iterable, including lists. Question 49. When visualizing a confusion matrix with seaborn, which function is typically used? A) sns.heatmap()
Question 52. Which Python library provides tools for building and evaluating A/B tests directly from pandas DataFrames? A) statsmodels B) scikitâlearn C) seaborn D) plotly Answer: A Explanation: statsmodels offers statistical tests (t-test, chiâsquare) that can be applied to DataFrames. Question 53. When you need to convert a pandas Series of timestamps to a different timezone, which method is used? A) tz_convert('America/New_York') B) to_timezone('EST') C) convert_tz('UTC') D) shift_timezone('US/Eastern') Answer: A Explanation: tz_convert() changes the timezone of a timezoneâaware datetime Series. Question 54. Which of the following statements about the @staticmethod decorator is true? A) It allows the method to access instance attributes. B) It can be called without creating an instance of the class. C) It must receive self as the first argument. D) It automatically caches the methodâs return value. Answer: B Explanation: A static method behaves like a plain function that lives in the class namespace and does not require self.
Question 55. In a Jupyter Notebook, which magic command measures the execution time of a single line of code? A) %timeit B) %time C) %run_time D) %benchmark Answer: B Explanation: %time reports the wallâclock time for one execution of the line. Question 56. Which Python data structure is best suited for fast membership tests when checking if a leadâs email domain is in a blacklist? A) list B) tuple C) set D) dict Answer: C Explanation: Sets provide O(1) averageâcase lookup time for membership tests. Question 57. When using the requests library to POST JSON data to Leadscore.io, which argument should you provide? A) data=json_data B) json=json_data C) params=json_data D) files=json_data Answer: B