From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array indexes start at 1.
Bicycle ridership in a city is studied. Examination of several years of data revealed that 30% of the people who regularly ride bicycles in a given year do not regularly ride bicycles in the subsequent year. Additionally, 2% of the people who do not regularly ride bicycles in that year begin to ride bicycles regularly in the subsequent year. If 5,000 people ride bicycles and 100,000 people do not ride bicycles in a given year, then the following program calculates the number of cyclists in the subsequent year (cycling) and that of people who do not ride bicycles in the subsequent year (noncycling):
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program.
The function coupon receives the argument prod_id (a positive integer value) of product ID, and pur_prod (a positive integer value) of the number of purchased products by a customer. The function returns the number of coupons.
For every purchase of three products of the product ID of which the last digit is three, the customer receives one coupon. Otherwise, they receive no coupon.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array index starts at 1.
The program determines the second-largest element of an integer-type array and outputs its value. For instance, the second largest element of the array {2, 6, 9, 1, 7, 5} is 7. Here, we assume that the array has two or more elements and that no duplicate elements are present in the array.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program.
The procedure primeFactors outputs the prime factors for the input values as its argument. The first few prime numbers are 2, 3, 5, 7, 11, and 13. For instance, if the input integer is 12, the output is “2×2×3”. If the input integer is 78, the output is “2×3×13”. The input integer must be greater than 1.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array index starts at 1.
Function calcGeoMean receives the array dataArray (the number of elements ≥ 1) as an argument and returns the geometric mean of values in dataArray as the return value. For the numbers a1, a2, …, an, the geometric mean is n√(a1 × a2 × ⋯ × an). Here, the pow( function returns a real value by raising x to the power of y. In the program, division is performed in data type real.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A through C in the program.
The standard form of a quadratic equation is as follows:
ax2 + bx + c = 0, where a, b and c are real numbers and a ≠ 0.
Here, the term b2 - 4ac is known as the discriminant of a quadratic equation. It indicates the nature of the roots. The formula for solving a quadratic equation is shown in the figure. If the discriminant value is positive, there are two solutions; if it is zero, there is one solution. Here, we assume that the discriminant value is non-negative.
Figure The formula for solving a quadratic equation
The procedure findRoots receives three real number arguments a, b, and c as coefficients and outputs the value of the root(s) of the quadratic equation. Function sqrt( returns the principal square root value of the parameter discriminant.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program.
Given two strings, str1 and str2, the task is to determine the length of the longest common subsequence (LCS), that is, the length of the longest subsequence present in both strings. For instance, if str1 is “ABXDZ” and str2 is “ABCD”, the LCS between str1 and str2 will be “ABD” and the length of the LCS will be 3.
The function lcs( takes two strings str1 and str2 and two integers m and n as arguments. str1 and str2 are the strings on which the length of the LCS is calculated. m and n are indexes addressing the target characters in str1 and str2, respectively. On the first call, m and n represent the lengths of str1 and str2, respectively. The function returns an integer containing the value of the length of the LCS of str1 and str2. For instance, the function may be called as lcs(.
Another function max( is also used. The function takes two integers a and b as arguments. It compares these two integers and returns the integer value of whichever is the maximum between a and b.
Answer group
From the answer group below, select the correct answer to be inserted into blank in the description.
This program performs operations on a priority queue.
A priority queue is a queue where the handled elements have a priority assigned to them, and the elements are extracted with the order of the highest priority first. The class PrioQueue represents a priority queue. The Figure shows an explanation of the class PrioQueue. Here, the priority is the integer value 1, 2, or 3, and the smaller the value the higher the priority.
When the procedure prioSched is called, the order of the output is blank.
Figure Explanation of the class PrioQueue
Answer group
From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array indexes start at 1.
The procedure traverse traces through a vertex of the graph shown in the Figure, and outputs all vertex numbers in the graph. The vertex number of the graph is specified with the argument k. The global variable n indicates the number of vertices in the graph. The global array graph represents the graph in the figure. Each element graph[i][j] is equal to 1 if an edge exists between vertices i and j, and it is equal to 0 otherwise. The global array visited stores boolean values, where visited[i] indicates whether vertex i of the graph has been visited during the procedure.
When the procedure is called as traverse(, the output is in the order blank.
Figure Structure of the graph
Answer group
From the answer group below, select the correct answer to be inserted into blank in the program.
The procedure addNode adds a node to a singly-linked list at the position specified by the argument pos. The argument pos is a positive integer that is equal to or less than the (number of nodes + 1) in the list. The position at the top of the list is 1.
The class ListNode represents a node in a singly-linked list. The table summarizes an explanation of the member variables of the class ListNode. ListNode-type variables store references to instances of the class ListNode. A reference to the first node in the list is pre-stored in the global variable listHead.
Table Explanation of the member variables of the class ListNode
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array indexes start at 1.
The procedure sort sorts an integer array containing certain number (≥ 2) of elements in ascending order.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array index starts at 1.
The function isPalindrome determines whether the character array s given as argument is a palindrome. Palindromes are words when read backward will still be the same such as “noon” and “madam.”
If character array s is a palindrome, it returns the value true and if not, the function returns false.
The table lists examples of s given to the function isPalindrome and the return values. In the program, areas outside of the arrays must not be referenced.
Table Examples of s given to the function isPalindrome and the return values
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array indexes start at 1.
Hashing in data structures is a fundamental concept used for efficient data retrieval and storage mechanisms. A program storing a key-data pairs in an array by transforming keys into array indexes using a hash function exists. A collision occurs when two keys hash to the same index in the array representing the hash table. A common method handling collisions, the probing mechanism (checking for an available element), is used in the function. The procedure insertData inserts a pair of key and data, if the element in the array is {undefined}. Assumptions are made that no data with the same key is stored, and that at least one element in the array hashTable is {undefined} when the procedure insertData is called. The function hashFunction takes a key as input and returns a hash value.
Answer group
From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array indexes start at 1.
The function summarize receives the array sortedData sorted in ascending order and returns five values that characterize the array. The array sortedData must have at least one element. The summarize calls the findRank with two arguments, sortedData and q.
When the function summarize is called as summarize(, the return value is blank.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program. Here, the array indexes start at 1.
Suppose the weather in a city, from day to day, follows a Markov process. This implies the next day’s weather depends only on today’s weather and not on those of the previous days. If it rains today in the city, a probability 0.3 exists that it will rain again tomorrow. Similarly, the probability that tomorrow’s weather will be sunny is 0.4 and that it will be cloudy is 0.3. If today’s weather is sunny, the next day will be rainy, sunny, or cloudy with probabilities 0.2, 0.7, and 0.1, respectively. Additionally, if today’s weather is cloudy, the next day will be rainy, sunny, or cloudy with probabilities 0.25, 0.5, and 0.25, respectively.
Let us say that the weather is in state 1 if it is rainy, in state 2 if it is sunny, and in state 3 if it is cloudy. Then, the above is a three-state Markov chain whose transition probabilities are given by the following:
Using this transition matrix, the probability distribution of the weather after several days can be estimated.
The program calculates the probability distribution of the weather of the city after three days from the present day and outputs a 3 × 3 square matrix that shows this probability distribution of the weather. For instance, if the weather on the present day is sunny (state 2), the probability that the weather three days after will be rainy (state 1) is the value in the second row and the first column of the outputted matrix.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A through C in the program.
Function hammingDistance receives two strings as argument and returns Hamming distance as the return value. Hamming distance is a metric used to measure the difference between two strings of equal length. It counts the number of positions at which the corresponding characters are different. For instance, the return value is 2 when the function hammingDistance( is called, because positions 2 and 5 have different characters.
It can also be extended to strings of different lengths by considering the unmatched characters as differences. For instance, the return value is 5 when the function hammingDistance( is called, because of two differences in first six characters and addition of three extra unmatched characters.
Answer group
From the answer group below, select the most appropriate combination of answers to be inserted into A and B in the description.
Company A is an e-commerce company specializing in sporting goods. One morning, employee X of the company's accounting department starts up his PC to begin his work. When he logged into his PC, he saw an unfamiliar screen with the following message:
The accounting department immediately requested the security team in company A to help resolve the situation. The security team analyzed all the PCs in the accounting department, including that of employee X, and noted the following:
The security team and the accounting department decided to take the following approaches and specific measures as a plan to strengthen the measures against future ransomware attacks.
Table 1. Approaches and Specific Measures (excerpts)
Answer group
From the answer group below, select the correct answer to be inserted into blank in the description.
Company B runs several web services. Mr. Y is a software engineer in the company. He was directed to develop a feature that prevents web service users from setting weak passwords. Mr. Y investigated and found that “Password Entropy” is the important factor for the password strength.
Password entropy measures the strength of a password based on the difficulty of cracking the password through guessing or a brute-force attack. The entropy of a password is typically based on the type of characters used—lowercase letters, uppercase letters, numerical digits, or special characters—and the length of the password or total number of characters.
Password entropy formula:
You can measure the entropy of a password in bits using the following formula:
E = ⌊L ×Log2 (R)⌋
In this formula:
The following totals show the breakdown for each character set as they appear on a typical American QWERTY keyboard:
Lowercase letters (a–z) = 26.
Uppercase letters (A–Z) = 26.
Numerical digits (0–9) = 10.
Special characters (!, @, #, $, %, ^, etc.) = 32.
The password vfssxfrb has a pool of 26 characters (lowercase letters);
Changing the password to JAAdMAdE would increase the pool to 52 characters (lowercase letters and uppercase letters);
Changing it further to u7aHqsbt would increase the pool to 62 characters (lowercase letters, uppercase letters along with numbers) and
Finally, Re*ct7$% has a pool of 26 + 26 + 10 + 32 = 94 characters (lowercase letters, uppercase letters, numbers, and special characters).
In our example:
Here, when the password is A6GmyVyOC (Using numerical digits, lowercase letters, and uppercase letters. L = 9), the password entropy is blank bits.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the description.
Company X is an investment company. Recently, one of their database servers was attacked by an attacker.
Mr. L, the security team leader of company X, decided to ask Ms. A, a security analyst working for the same company, to analyze the logs. Mr. L will extract log entries related to database access from the log file of the attacked database server and send the extracted log entries to Ms. A.
When sending access log data from Mr. L to Ms. A, the following conditions were agreed upon in advance:
They each have an RSA key pair and have already exchanged their public keys with each other. They sign, verify, encrypt, and decrypt using those keys and a previously shared cryptographic processing software.
This time, the log entries must be A and then B.
Answer group
From the answer group below, select the most appropriate combination of answers to be inserted into A and B in the description.
Company Y, a trading company, is developing an e-commerce web application for selling products to customers directly. The web server hosting the web application is installed on-premise and the web application is to be developed in-house. The communications to the web server are allowed only with HTTPS and the server certificate is already signed by the third party and installed on the web server. Company Y has an IT department comprising three teams—Developer, Security, and Tech Support—and the requirements for the web application are specified as follows (excerpt):
During the initial project meeting, the members from each department discuss their respective tasks. The developer team requests the security team to derive specific tasks for the above requirements related to security. Ms. B, a member of the security team, suggests the following tasks:
Answer group