From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array index starts at 1.
When the program is executed, the output is “blank”.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A through C in the description.
Function f receives an integer value as argument argval and returns the grade character. The return value of f(, f(, and f( are “A,” “B,” and “C,” respectively. Note that the function has a specification bug.
Answer group
From the answer group below, select the correct answer to be inserted into blank in the program. Here, the array indexes start at 1.
The function distance receives integer arrays S and T of size n as arguments and returns the Manhattan distance of the two vectors that can be computed as ∑ni=1|Si − Ti| . Function abs, which is used by the function distance, returns the absolute value of an integer. Assume that n is 1 or greater.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A through C in the program.
The function isHarshad checks whether the given integer n is a Harshad number. The function returns true if the given number is a Harshad number, or false otherwise. A Harshad number, also known as a Niven number, is a positive integer that is divisible by the sum of its digits. For instance, 156 is a Harshad number because the sum of its digits (1 + 5 + 6 = 12) divides it evenly without a remainder (156 ÷ 12 = 13).
Answer group
From the answer group below, select the correct answer to be inserted into blank in the description.
When the procedure proc1 is called, the output is “blank” in turn.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the program.
The quadratic equation a1x2 + b1x + c1 = 0 can be formulated as x2 − 2(−b1/2a1) + (c1/a1) = 0 , where a1 ≠ 0 . If we replace (−b1/2a1) and (c1/a1) by b and c respectively, it can be further formulated as x2 − 2bx + c = 0, and the roots are as follows:
Case 1: if b2 − c = 0, double root b,
Case 2: if b2 − c > 0, two real roots b ± √b2 − c,
Case 3: if b2 − c < 0, two imaginary roots b ± i√c − b2, where i = √−1.
The procedure quadEquation takes the coefficients of a quadratic equation in arguments a1, b1, and c1 and uses the above formula to determine and output the roots. Here, a1 is not 0 and function sqrt returns the principal square root of its non-negative argument.
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 linearSearch linearly searches the global array D using the recursive function recursive, and if an element with the same value as the argument searchKey exists, it returns that element index, otherwise -1 is returned. Assume that the array D has no duplicate elements.
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 0.
The program implements a queue that has a fixed capacity and only accepts integers. If the queue is not full, the function enqueue appends the specified value to its end and returns true. Otherwise, it returns false. If the queue is not empty, the function dequeue removes an element from the queue and returns its value. Otherwise, it returns undefined. The figure illustrates the working of a queue with capacity to hold up to seven integers. Initially, the queue contains five integers, with front, rear, and count set to 3, 1, and 5, respectively. Then, enqueue( and dequeue( are called in that order.
enqueue( is called.
dequeue( is called.
Figure Queue with capacity of seven
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 isPerfectBinaryTree checks whether the binary tree with a given root node is perfect. In a perfect binary tree, all the internal nodes have exactly two children, and all leaf nodes are at the same level. The function returns true if the tree is perfect, or false otherwise.
The class Node models a node of a binary tree as described in Table 1. A Node-type variable holds a reference to an instance of the class Node.
Table 1 Class Node
Table 2 describes the functions used in the program.
Table 2 Functions
Answer Group
From the answer group below, select the correct combination of answers to be inserted into A through C in the program.
The function mergeTwoSortedList concatenates two linear sorted linked lists in a sorted order and returns one linear linked list of sorted order. Each element of the linear linked lists is represented by the class ListElement. The table lists the description of the class ListElement. ListElement-type variable holds a reference to an instance of the class ListElement. Here, head1 and head2 represent the headers of the two sorted linked lists, respectively and are of type ListElement. After concatenation of two existing linear linked lists, the function returns a linear linked list headed with result, which is of type ListElement. Both the input linked lists and returned linked list are sorted in ascending order of the member variable val.
Table Explanation of the member variables of the class ListElement
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.
Counting Sort is a non-comparison-based sorting algorithm. It is suitable for sorting a collection of objects according to keys that are small positive integers by means of counting the occurrences of key values in all data and then using those counts to place the values in their correct sorted positions.
The function countSort below describes a simple variant of counting sort algorithm. The function countSort receives 2 arguments as follows: arr, the array of small positive integers to be sorted, and M, the max value for the range of the array (from 1 to M), and returns the sorted array. Element count[k] of local array count holds the frequency of key value k in the range 1 to M.
For instance, when the function countSort is called as countSort(, the value of array count is {1, 0, 2, 1, 2, 1}, and the function returns {1, 3, 3, 4, 5, 5, 6}.
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 function isIsomorphic compares the two character arrays s1 and s2 that are given as arguments. Both s1 and s2 have one or more elements.
Two character arrays are considered isomorphic if the characters in s1 can be consistently replaced to obtain s2 without changing the order of characters. Each character in s1 must map to exactly one character in s2, and no two characters in s1 may map to the same character in s2. A character may map to itself.
If s1 and s2 do not have the same number of elements, the function returns false. Otherwise, it returns true if s1 and s2 are isomorphic and false if they are not.
The table lists examples of s1 and s2 given to the function isIsomorphic and the return values.
Table Examples of s1 and s2 given to the function isIsomorphic and the return values
Answer group
From the answer group below, select the correct answer to be inserted into blank in the program. Here, the array indexes start at 1.
The function extractEmails receives text as an argument, extracts email addresses from the text, and returns all collected email addresses. Here, a string in the format “name@domain” is considered to be an email address, where “name” and “domain” comprise only alphanumeric characters and the characters “.” (dot), “_” (underscore), and “-” (hyphen-minus). The table shows the description of the functions used in the function extractEmails.
Table Functions used in the function extractEmails
extractEmails( returns {"john.. In addition, extractEmails( returns {"a@b", "b@c"}.
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.
Percentile is a statistical measure used to describe the position of a particular value in a dataset relative to the remainder of the values. In education, percentiles are commonly used to rank students’ performance. For instance, if a student is in the 90th percentile, it implies the score of the student is higher than 90% of the other students. To calculate percentile of a student, use the following formula:
For instance, if the scores of five students are given as an array {30, 60, 80, 72, 15}, then the percentile array for each student will be {25, 50, 100, 75, 0}. This implies that the number of students with scores less than 30 is 1; thus, the percentile for the first student is (1 ÷ (5 - 1) × 100) = 25, the number of students with scores less than 60 is 2, and the percentile for the second student is (2 ÷ (5 - 1) × 100) = 50. The same applies thereafter.
The function calculatePercentile receives the scores of each student in the argument arr and calculates and returns the percentile of each student. Assume that the argument arr contains two or more numbers between 0 and 100.
Answer group
From the answer group below, select the correct combination of answers to be inserted into A and B in the description.
Bag of Words is a representation of text that describes the occurrence of words in a document. It is a feature extraction method in text mining. From a document collection (or corpus), a feature vector for each document can be created by considering the count of each word in that document.
The following are two documents that construct a text corpus:
document-I: John likes to watch movies. Mary likes movies too.
document-II: Mary also likes to watch football games.
Here, the word sequence, defined by the unique words (ignoring case and punctuation) in the documents, is as follows:
{John, Mary, likes, to, watch, movies, too, also, football, games}
Now, feature vectors for document-I and document-II can be created using the unique words.
Feature Vector for document-I = {1, 1, 2, 1, 1, 2, 1, 0, 0, 0}
Feature Vector for document-II = {0, 1, 1, 1, 1, 0, 0, 1, 1, 1}
Again, two new text documents and the corresponding word sequence are given below:
document-III: He is a good boy. An honest boy is good.
document-IV: He is an honest boy. The good boy is honest.
Here, the word sequence for those two documents is {He, is, a, an, good, boy, honest, the}. Then, the Feature Vectors for document-III and document-IV will be A and B, respectively.
Answer group
From the answer group below, select the correct answer to be inserted into blank in the program. The same answer goes into both blanks blank. Here, the array index starts at 1.
The program converts the code point of a Unicode character to a 2-byte UTF-8 encoding. In this question, “(16)” after a numerical value indicates a hexadecimal value. Each Unicode character is given an integer value that is known as a code point. A character with a code point that ranges from 80(16) to 7FF(16) is encoded to a 2-byte value as below.
Let the bit pattern with a 2-byte length be: 110xxxxx 10xxxxxx. The underlined 11 “x” positions in the bit pattern store the 11-bit code point. The code point is justified to the right, and 0 is stored in any leftover “x” positions. This 2-byte value is the encoded result. For instance, when the code point AE(16) for Registered Sign character “®” is represented in binary, it is 10101110. When this is stored right-justified in the “x” positions in the bit pattern above, it is 110xxx10 10101110. When 0 is stored in the three leftover “x” positions, the UTF-8 encoding for Registered Sign character “®” 11000010 10101110 is obtained. In decimal form, this corresponds to {194, 174}.
The function encode converts a Unicode code point that is passed as an argument to UTF-8 encoding, and returns an integer array that stores it one byte per element from the start of the array. It is assumed that only an integer value that ranges from 80(16) to 7FF(16) is passed to encode as an argument.
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 P conducts training sessions for junior security analysts within its security team. As part of this training activity, the team reviews simulated authentication log data and discusses how different password attack techniques may manifest in real-world systems. The purpose of this exercise is to help analysts accurately identify attack patterns, understand attacker behavior, and evaluate the defensive controls that are effective against each type of attack.
During the exercise, the team focuses on three major password attack techniques, understanding that their visibility in authentication logs varies as summarized in Table 1.
Table 1 Major password attack techniques
As part of the training, the security team reviews multiple sample authentication logs recorded at an authentication server, as summarized in Tables 2 and 3. The participants analyze the authentication patterns observed in both tables and determine the correspondence of each pattern corresponds to the password attack techniques listed in Table 1.
Table 2 Sample authentication logs (Pattern A)
Table 3 Sample authentication logs (Pattern B)
Based on this analysis, they conclude that the pattern observed in Table 2 is categorized as A, and that observed in Table 3 is categorized as B, as summarized in Table 1.
Answer group
From the answer group below, select the most appropriate combination of answers to be inserted into A and B in the description.
A research laboratory at University Q plans to introduce a cloud-based database to centrally store and manage data for one of its research projects. This database will be used by professors, researchers, students, and administrative staff participating in the project. Table 1 summarizes the data types, descriptions, and the roles and permitted operations for each user group.
Table 1 Data Types and User Requirements (Excerpt)
The system administrator at University Q, who is responsible for introducing the database, reviewed the data types and user roles with the information security officer of the university. According to the information security policy of University Q, users must be granted only the permissions necessary for their roles to minimize potential damage in the event of account compromise. Based on this policy, the system administrator created user groups and configured access permissions for each content type. Table 2 lists the resulting access right assignments for the database.
Table 2 Access Right Assignments (Excerpt)
Note:
R: Read-only (viewing allowed)
RW: Read and Write (includes creating and modifying)
(-): Not allowed (no access)
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 R is an e-commerce company that sells smartphone accessories through its website. In response to the increasing prevalence of SQL injection attacks in recent years, Company R decided to conduct a security training program for its security analysts, focusing specifically on SQL injection vulnerabilities.
[Explanation of SQL Behavior]
As part of the training, an explanation was provided to help the security analysts understand the working mechanism of SQL statements. In typical web applications, authentication is performed by constructing an SQL statement based on a predefined template. The application inserts the user-provided username and the hashed value of the user-provided password into the template and submits the resulting SQL statement to the database to check whether a matching record exists. An example of such an SQL query template is shown in figure given below.
Figure SQL Query Template for Authentication
If user input is incorporated into an SQL statement without proper handling, the structure of the SQL query may be altered, enabling attacks such as SQL injection. For instance, SQL syntax elements included in the input may be interpreted by the database. One common element is “--”, which starts a comment; any text that follows “--” is ignored by the database engine, effectively disabling the remaining part of the SQL statement, including the password check.
[Hands-on Verification]
The security analysts participated in a hands-on lab using a dedicated training server. They submitted crafted input values through the application’s authentication form. The application processed these inputs, inserted the username and the hashed password value into the SQL template shown in the figure above, generated a complete SQL statement, and executed it against the database.
The database contained a preregistered admin user with a hashed password that was not disclosed to the participants. They tested several input values for <input_username> while leaving the password input field empty in the authentication form to determine whether authentication could be bypassed, and summarized the results in table given below.
Table Evaluation Results
Answer Group
From the answer group below, select the most appropriate answer to be inserted into blank in the description.
Company S had recently released a photo editing application named Application Y for mobile platforms.
As storage for users to upload the photos they wish to process, Application Y utilizes a cloud storage service. The cloud storage service exposes REST API endpoints that accept requests from REST client. Application Y makes direct REST API calls to the cloud storage service, and the access tokens required to invoke these APIs are embedded directly within the application logic. Figure 1 shows the portion of the Application Y architecture related to access to the cloud storage service. Other components are omitted for simplicity.
Figure 1 Application Y architecture related to access to the backend storage service
A security researcher discovered that the access token embedded in Application Y could be extracted from Application Y. The researcher was able to invoke the REST API directly and access the storage service using the extracted token.
The developer team of Company S proposed the following for architectures to prevent future exposure of storage access tokens.
Architecture One: Use a Secure Vault to manage access tokens.
In this architecture, access tokens are stored in a Secure Vault, which is a digital safe for protecting sensitive data such as API access tokens. When Application Y needs to access the storage service, it retrieves a temporary token from the Secure Vault and uses the token to make REST API calls directly to the cloud storage service over HTTPS.
Figure 2 Architecture One
Architecture Two: Use a VPN to secure communication.
In this architecture, Application Y establishes a VPN connection to the cloud environment. All REST API calls from Application Y to the cloud storage service are transmitted through the VPN. The client application continues to use an access token to invoke the REST APIs of the storage service.
Figure 3 Architecture Two
Architecture Three: Use an API Server.
In this architecture, an API server is introduced between Application Y and the cloud storage service. The API server securely stores the access tokens and performs REST API Calls. Application Y communicates only with the API server over HTTPS and does not possess access tokens for the cloud storage service. All authentication, authorization, and business logic are enforced on the API server, which performs REST API calls to the storage service on behalf of the client.
Figure 4 Architecture Three
Architecture Four: Use a proxy server.
In this architecture, a proxy server is deployed between Application Y and the cloud storage service. The proxy server stores the access credentials required to access the storage service. Application Y sends REST API requests to the proxy server over HTTPS, and the proxy server forwards these requests to the cloud storage service using the stored credentials. The proxy server does not perform application-specific authentication, authorization, or business logic enforcement, and simply relays REST API requests from the client to the storage service.
Figure 5 Architecture Four
By comparing them, the security team of Company S suggested the application development team redesign the application architecture to Architecture blank .
Answer group