LearnIPAReviewHistoryAI
Profile
AboutHow I passedFeedback
LearnIPA
Review
History
Profile
LearnIPAReviewHistoryAI
Profile
AboutHow I passedFeedback
IPA FE Subject B sample

Questions IPA Japan published in 基本情報技術者試験 科目B サンプル問題, translated into English, with IPA's answers. ITPEC is based on the same exams, so they are good practice for ITPEC too.

Question 1

From the answer group below, select the correct answer to be inserted into blank in the description.

When the program is executed, the output is “blank”.

[Program]
integer: x ← 1
integer: y ← 2
integer: z ← 3
x ← y
y ← z
z ← x
output the value of y and the value of z in this order, separated by a comma

Answer group

Question 2

From the answer group below, select the correct combination of answers to be inserted into A through C in the program.

The function fizzBuzz returns “divisible by 3” if the value given as the argument is divisible by 3 and not divisible by 5, “divisible by 5” if it is divisible by 5 and not divisible by 3, and “divisible by 3 and 5” if it is divisible by 3 and 5. In all other cases, it returns “divisible by neither 3 nor 5”.

[Program]
○ string: fizzBuzz(integer: num)
string: result
if (num is divisible by A)
result ← “divisible by A”
elseif (num is divisible by B)
result ← “divisible by B”
elseif (num is divisible by C)
result ← “divisible by C”
else
result ← “divisible by neither 3 nor 5”
endif
return result

Answer group

OptionABC
Question 3

From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array index starts at 1.

The function makeNewArray receives an integer-type array with two or more elements as its argument and returns an integer-type array. When the function makeNewArray is called as makeNewArray({3, 2, 1, 6, 5, 4}), the value of the element at index 5 of the returned array is blank.

[Program]
○ integer []: makeNewArray(integer []: in)
integer []: out ← {} // array with 0 elements
integer: i, tail
add the value of in[1] to the end of out
for (increase i from 2 to the number of elements in in by 1)
tail ← out[the number of elements in out]
add the result of (tail + in[i]) to the end of out
endfor
return out

Answer group

Question 4

From the answer group below, select the correct combination of answers to be inserted into A through C in the program.

The function gcd finds the greatest common divisor of the two positive integers num1 and num2 given as arguments, by using the properties (1) through (3) below.

(1)When num1 and num2 are equal, the greatest common divisor of num1 and num2 is num1.(2)When num1 is greater than num2, the greatest common divisor of num1 and num2 is equal to the greatest common divisor of (num1 - num2) and num2.(3)When num2 is greater than num1, the greatest common divisor of num1 and num2 is equal to the greatest common divisor of (num2 - num1) and num1.
[Program]
○ integer: gcd(integer: num1, integer: num2)
integer: x ← num1
integer: y ← num2
A
if (B)
x ← x - y
else
y ← y - x
endif
C
return x

Answer group

OptionABC
Question 5

From the answer group below, select the correct answer to be inserted into blank in the program.

The function calc receives the positive real numbers x and y, and returns the result of the calculation of √x2 + y2. The function pow, which is used by the function calc, receives a positive real number a as the first argument and a real number b as the second argument, and returns the value of a raised to the power of b as a real-type value.

[Program]
○ real: calc(real: x, real: y)
return blank

Answer group

Question 6

From the answer group below, select the correct answer to be inserted into blank in the program.

The function rev receives the 8-bit type argument byte, and returns the value with the order of its bits reversed. For example, when the function rev is called as rev(01001011), the return value is 11010010.
Here, operator ∧ represents a bitwise logical product, operator ∨ represents a bitwise logical sum, operator >> represents a logical shift to the right, and operator << represents a logical shift to the left. For example, value >> n performs a logical shift of the value of value by n bits to the right, and value << n performs a logical shift of the value of value by n bits to the left.

[Program]
○ 8-bit: rev(8-bit: byte)
8-bit: rbyte ← byte
8-bit: r ← 00000000
integer: i
for (increase i from 1 to 8 by 1)
blank
endfor
return r

Answer group

Question 7

From the answer group below, select the correct answer to be inserted into blank in the program.

The function factorial receives a non-negative integer n as an argument, and returns its factorial. The factorial of a non-negative integer n is 1 when n is 0; otherwise, it is the number obtained by multiplying together all the integers from 1 to n.

[Program]
○ integer: factorial(integer: n)
if (n = 0)
return 1
endif
return blank

Answer group

Question 8

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.

ConstructorDescription
PrioQueue()Creates an empty priority queue.
MethodType of return valueDescription
enqueue(string: s, integer: prio)NoneAdds string s as an element to a priority queue with the priority prio.
dequeue()stringExtracts the element with the highest priority in a priority queue and returns it. If multiple elements with the highest priority exist, it extracts the element that was added first and returns it.
size()integerReturns the number of elements that are stored in a priority queue.

Figure Explanation of the class PrioQueue

[Program]
○ prioSched()
PrioQueue: prioQueue ← PrioQueue()
prioQueue.enqueue("A", 1)
prioQueue.enqueue("B", 2)
prioQueue.enqueue("C", 2)
prioQueue.enqueue("D", 3)
prioQueue.dequeue() /* The return value is ignored */
prioQueue.dequeue() /* The return value is ignored */
prioQueue.enqueue("D", 3)
prioQueue.enqueue("B", 2)
prioQueue.dequeue() /* The return value is ignored */
prioQueue.dequeue() /* The return value is ignored */
prioQueue.enqueue("C", 2)
prioQueue.enqueue("A", 1)
while (prioQueue.size() is not equal to 0)
output prioQueue.dequeue()
endwhile

Answer group

Question 9

From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array index starts at 1.

The procedure order outputs all the node numbers while traversing the subtree of the binary tree in the figure whose root is the node specified by the argument. The global array tree represents the binary tree in the figure. Each element of the array tree is an array that stores the node numbers of the children of the corresponding node, in the order of the left child and then the right child. For example, the element at index 1 of the array tree is an array consisting of the node numbers of the children of node number 1, and it stores node number 2 of the left child and node number 3 of the right child as the array {2, 3}.
When the procedure order is called as order(1), the node numbers are output in the order blank.

1234567891011121314
Note 1:The value in each ○ is the node number.Note 2:When a node has only one child, it is the left child.

Figure Binary tree handled by the program

[Program]
global: integer [][]: tree ← {{2, 3}, {4, 5}, {6, 7}, {8, 9},
{10, 11}, {12, 13}, {14}, {}, {}, {},
{}, {}, {}, {}} // {} is an array with 0 elements
○ order(integer: n)
if (the number of elements in tree[n] is equal to 2)
order(tree[n][1])
output n
order(tree[n][2])
elseif (the number of elements in tree[n] is equal to 1)
order(tree[n][1])
output n
else
output n
endif

Answer group

Question 10

From the answer group below, select the correct answer to be inserted into blank in the program.

The procedure delNode deletes the element at the position specified by the argument pos from a singly linked list. The argument pos is a positive integer that is equal to or less than the number of elements in the list. The position at the head of the list is 1.
The class ListElement represents an element of a singly linked list. The table shows an explanation of the member variables of the class ListElement. ListElement-type variables store references to instances of the class ListElement. A reference to the head element of the list is pre-stored in the global variable listHead.

Table Explanation of the member variables of the class ListElement

Member variableTypeDescription
valcharacterThe value of the element
nextListElementReference to the next elementIf there is no next element, the status is undefined
[Program]
global: ListElement: listHead // stores the head element of the list
○ delNode(integer: pos) /* pos is a positive integer equal to or less than the number of elements in the list */
ListElement: prev
integer: i
if (pos is equal to 1)
listHead ← listHead.next
else
prev ← listHead
/* if pos is equal to 2, the iteration process is not executed */
for (increase i from 2 to pos - 1 by 1)
prev ← prev.next
endfor
prev.next ← blank
endif

Answer group

Questions 11–20
Question 11

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 function binSort is called as binSort(blank), the array of the return value contains no undefined elements, and its values are arranged in ascending order.

[Program]
○ integer []: binSort(integer []: data)
integer: n ← the number of elements in data
integer []: bins ← {n undefined values}
integer: i
for (increase i from 1 to n by 1)
bins[data[i]] ← data[i]
endfor
return bins

Answer group

Question 12

From the answer group below, select the correct answer to be inserted into blank in the program. Here, the array index starts at 1.

The function simRatio compares the two character-type arrays s1 and s2, each with one or more elements, that are given as arguments, and if their numbers of elements are equal, returns (the number of pairs of elements with the same index whose characters match ÷ the number of elements in s1) as a real number, as an index of how similar the sequences of the arrays are. For example, the return value is 1 when all elements of the arrays match, and 0 when none of the elements match.
If the numbers of elements of the two arrays are not equal, the function returns −1.

The table shows examples of s1 and s2 given to the function simRatio and the return values. In the program, areas outside the arrays must not be referenced.

Table Examples of s1 and s2 given to the function simRatio and the return values

s1s2Return value
{"a", "p", "p", "l", "e"}{"a", "p", "p", "l", "e"}1
{"a", "p", "p", "l", "e"}{"a", "p", "r", "i", "l"}0.4
{"a", "p", "p", "l", "e"}{"m", "e", "l", "o", "n"}0
{"a", "p", "p", "l", "e"}{"p", "e", "n"}-1
[Program]
○ real: simRatio(character []: s1, character []: s2)
integer: i, cnt ← 0
if (the number of elements in s1 ≠ the number of elements in s2)
return -1
endif
for (increase i from 1 to the number of elements in s1 by 1)
if (blank)
cnt ← cnt + 1
endif
endfor
return cnt ÷ the number of elements in s1 /* calculated as real numbers */

Answer group

Question 13

From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array index starts at 1.

The function search returns the index of the element if the value specified by the argument target is contained in the array specified by the argument data, and returns −1 if it is not contained. data is sorted in ascending order, and there are no duplicate values.
The function search has a defect. For example, in the case of data where blank, an infinite loop occurs.

[Program]
○ integer: search(integer []: data, integer: target)
integer: low, high, middle
low ← 1
high ← the number of elements in data
while (low ≤ high)
middle ← the quotient of (low + high) ÷ 2
if (data[middle] < target)
low ← middle
elseif (data[middle] > target)
high ← middle
else
return middle
endif
endwhile
return -1

Answer group

Question 14

From the answer group below, select the correct answer to be inserted into blank in the description. Here, the array index starts at 1.

This is a program that, based on an array that has one or more elements and is sorted in ascending order, returns five values that characterize the array.
When the function summarize is called as summarize({0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}), the return value is blank.

[Program]
○ real: findRank(real []: sortedData, real: p)
integer: i
i ← (p × (the number of elements in sortedData - 1)) rounded up to the nearest whole number
return sortedData[i + 1]
○ real []: summarize(real []: sortedData)
real []: rankData ← {} /* array with 0 elements */
real []: p ← {0, 0.25, 0.5, 0.75, 1}
integer: i
for (increase i from 1 to the number of elements in p by 1)
add the return value of findRank(sortedData, p[i]) to the end of rankData
endfor
return rankData

Answer group

Question 15

From the answer group below, select the correct combination of answers to be inserted into A and B in the description.

In tic-tac-toe, the move with which you have the highest possibility of winning is determined. With the following procedure, the state transitions of the game are represented as a tree structure, and the evaluation value of each node other than the root is calculated. As a result, the move with the highest evaluation value among the children of the root is regarded as the move with the highest possibility of winning. A move selected by you is represented by ○, and a move selected by the opponent is represented by ×.

[Procedure](1)With the current state of the board as the root, all the possible moves until either side wins or the game ends in a draw are represented in a tree structure.(2)The states of the leaves are evaluated as follows. ①If you win, 10 ②If you lose, −10 ③If it is a draw, 0(3)The evaluation value of each node other than the leaves is determined based on the evaluation values of all the children of the node. ①If the node is at your turn, the maximum evaluation value among the evaluation values of the children is regarded as the evaluation value of the node. ②If the node is at the opponent's turn, the minimum evaluation value among the evaluation values of the children is regarded as the evaluation value of the node.

When the game is in the state of the root at the top of the figure, there are three moves you can select. Of them, the evaluation value of the child pointed to by A is A, and the evaluation value of the child pointed to by B is B.

State of the rootYour turnABWinEvaluation value 10Opponent's turnLoseEvaluation value −10Your turnDrawEvaluation value 0WinEvaluation value 10DrawEvaluation value 0

Figure State transitions of tic-tac-toe

Answer group

OptionAB
Question 16

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 a Unicode code point to a 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. UTF-8 is one of the methods of encoding Unicode characters, and a character with a code point that ranges from 800(16) to FFFF(16) is encoded to a 3-byte value as below.

Let the bit pattern with a 3-byte length be 1110xxxx 10xxxxxx 10xxxxxx. The code point represented in binary is stored right-justified in the underlined “x” positions in the bit pattern, and 0 is stored in any leftover “x” positions. This 3-byte value is the UTF-8 encoding.

For example, when 3042(16), the code point of the hiragana character “あ”, is represented in binary, it is 11000001000010. When this is stored right-justified in the “x” positions in the bit pattern shown above, it is 1110xx11 10000001 10000010. When 0 is stored in the two leftover “x” positions, the UTF-8 encoding of “あ”, 11100011 10000001 10000010, is obtained.

The function encode converts a Unicode code point that is passed as an argument to UTF-8 encoding, and returns an integer-type array that stores it one byte per element in order from the start. It is assumed that only an integer value that ranges from 800(16) to FFFF(16) is passed to encode as an argument.

[Program]
○ integer []: encode(integer: codePoint)
/* the initial value of utf8Bytes is the value when all “x”s in the bit pattern are replaced with 0,
divided every 8 digits, and each deemed to be binary */
integer []: utf8Bytes ← {224, 128, 128}
integer: cp ← codePoint
integer: i
for (decrease i from the number of elements in utf8Bytes to 1 by 1)
utf8Bytes[i] ← utf8Bytes[i] + (cp mod blank)
cp ← the quotient of cp ÷ blank
endfor
return utf8Bytes

Answer group

Question 17

Company A, a manufacturer, sells products to individuals by using an EC site (hereinafter, Company A’s EC site is referred to as site A). On site A, Company A’s products and services can be searched, and site A has a login function and manages information such as the names and email addresses (hereinafter, member information) of individuals who have registered in advance to use site A (hereinafter, members). Site A runs on Company B’s PaaS, and uses the DBMS and the application server on the PaaS.
Company A outsources the development and operation of site A to Company C. The outsourcing contract between Company A and Company C states that Company C implements the countermeasures against vulnerabilities in the Web application programs.

Recently, an incident occurred in which a vulnerability in a Web site operated by another company in the same industry as Company A was exploited and personal information was leaked. Therefore, Company A requested Company D, which provides security assessment services, to perform a vulnerability assessment of site A. As a result of the vulnerability assessment, multiple security vulnerabilities that require countermeasures were pointed out. Figure 1 shows the findings from Company D.

Item No. 1 The OS of the application server used by site A has a known vulnerability, and there is a risk of an attack that exploits the vulnerability.Item No. 2 Site A has a cross-site scripting vulnerability, and there is a risk that member information is obtained illicitly.Item No. 3 The DBMS used by site A has a known vulnerability, and there is a risk of an attack that exploits the vulnerability.

Figure 1 Findings from Company D

QuestionFrom the answer group, select the appropriate combination of the organizations that deal with each of the item numbers in Figure 1.

Answer group

OptionItem No. 1Item No. 2Item No. 3
Question 18

Company A is a company with 1,000 employees that conducts IT development. There are 50 employees in the General Affairs Department and 50 in the Sales Department, and the others belong to the Development Department. 90% of the members of the Development Department are stationed at customer sites. Currently, the usage of PCs at Company A is as shown in Figure 1.

1 Company A’s PCs•Members of the General Affairs Department, members of the Sales Department, and members of the Development Department who work at Company A’s office are each lent one PC prepared by the company (hereinafter, Company A PC).•Members of the Development Department stationed at customer sites are not lent a Company A PC, but instead, shared PCs are provided for them to use when they come to Company A’s office.2 Use of the business system by members of the Development Department stationed at customer sites•For members of the Development Department stationed at customer sites to use the business system for applying for leave, settling expenses, etc., they need to use a shared PC.3 Use of VPN at Company A•A VPN server is installed at Company A, so that members of the Sales Department on business trips can make a VPN connection from a Company A PC to the internal network via the internet and use the business system. The rules stipulate that a Company A PC is to be used for VPN connections.

Figure 1 Usage of PCs at Company A

Company A considered it inefficient for members of the Development Department stationed at customer sites to come to Company A’s office only to use the business system, and decided to consider permitting members of the Development Department stationed at customer sites to use their personally owned PCs for business (BYOD) and to make VPN connections.

QuestionWhich of the following is the combination that lists two risks considered to increase or newly arise when members of the Development Department stationed at customer sites are permitted to make VPN connections from personally owned PCs? From the answer group, select the most appropriate one.
(i)Risk that VPN connections increase and availability is impaired(ii)Risk that a member of the Development Department stationed at a customer site loses a Company A PC(iii)Risk that a member of the Development Department stationed at a customer site clicks the URL in a phishing email and the personally owned PC is infected with malware(iv)Risk that a member of the General Affairs Department makes a VPN connection with a personally owned PC(v)Risk that a personally owned PC infected with malware is connected to the internal network by VPN and the malware spreads over the internal network

Answer group

Question 19

Company A is a mail-order company with 200 employees. It sells household goods, gift items, etc. to general consumers. Product Z, one of the products it handles, is handled by the Z Sales Section.

[Work of the Z Sales Section]

Currently, the staff of the Z Sales Section perform order management work and inquiry handling work for product Z. Figure 1 shows the procedure of the order management work for product Z.

Orders for product Z from customers arrive by email.(1) Input    The salesperson enters the details of a received order (including changes and cancellations) into the order management system1) (hereinafter, J system), and requests the sales manager2) to approve it.(2) Approval    The sales manager checks the details of the order against the result of the input into J system, and approves it if there is no problem. If there is a problem, the sales manager sends it back.
Note 1)Operated by the Information Systems Department of Company A. The users are the sales manager, the salespersons, etc.Note 2)Only one person, the section manager of the Z Sales Section.

Figure 1 Procedure of the order management work

[Operation privileges of J system]

The Z Sales Section has established the following usage policies for J system.

[Policy 1]Information entered by a user is approved by another user.[Policy 2]The sales manager can view the information of all the work of the Z Sales Section.

J system implements a function that grants users the operation privileges necessary for their work.
Recently, since the order management work for product Z has been growing with an increase in orders, it was decided to outsource part of it to Company B (hereinafter, an employee of Company B who performs the input work of the order management work for product Z is referred to as a Company B salesperson for product Z, and an employee of Company B who views the input results of the Company B salespersons for product Z and, if there are deficiencies, verbally asks Company A to send them back is referred to as a Company B sales manager for product Z).

For the outsourcing, the Z Sales Section communicated the following requirements on J system to the Information Systems Department.

[Requirement 1]When Company B makes an input, Company A approves it.[Requirement 2]When a salesperson of Company A makes an input, the sales manager of Company A approves it, as at present.

Based on the above, the Information Systems Department summarized in Table 1 the operation privileges to be granted to each user from now on, and had them checked by C, the information security leader of the Z Sales Section.

Table 1 Draft of operation privileges

Operation privileges grantedUserJ systemViewingInputApproval(Omitted)Salesperson of the Z Sales Section(Omitted)(Omitted)(Omitted)A1A2
Note:○ indicates that the operation privilege is granted.
QuestionFrom the answer group for A below, select the appropriate combination of words to be inserted into A1 and A2 in Table 1.

Answer group for A

OptionA1A2
Question 20

Company A is a company with 500 employees that deals in dietary supplements. The operation of Company A’s information systems, including its servers and firewall (hereinafter, FW), is handled by the Information Systems Department.
One day, there was an audit by the Internal Audit Department, and when Department Manager B of the Information Systems Department explained the operational status of the FW as shown in Figure 1, the findings shown in Table 1 were received.

•The operation of the information systems, including the FW, is handled by six operators belonging to the operations team of the Information Systems Department.•There are three tasks in the operation of the FW: editing of FW rules, checking of operation logs, and checking of the edited FW rules and approval of the operation (hereinafter, checking of the edited FW rules and approval of the operation is referred to as operation approval).•FW rules are edited in accordance with operation instructions prepared in advance.•The FW has three functions: editing of FW rules, checking of operation logs, and operation approval.•Changing an FW rule requires both editing of the FW rule and operation approval. Operation logs are checked before operation approval.•FW user IDs are issued individually to each operator, and user IDs are not shared.•In the FW, privileges to use the functions can be granted for each operator’s user ID.•Currently, all six operators are granted all privileges, and after an operator edits the rules of the FW, the operator who did the editing confirms that there are no errors in the operation and performs operation approval.•Passwords are used for logging in to the FW. The passwords are 8 alphanumeric characters.•In the operation of the FW, it can be set for each operator’s user ID whether the operator can log in at the console without going through the network, and whether the operator can log in remotely via the network.•The FW provides the same functions whether one logs in at the console without going through the network or logs in remotely via the network.•The FW is installed in the server room, and several other kinds of servers are also installed in the server room.•Only the operators are permitted to enter and leave the server room.

Figure 1 Operational status of the FW

Table 1 Findings from the Internal Audit Department

FindingDetails of finding
Finding 1In the work of operating the FW, duties are not appropriately segregated.
Finding 2(Omitted)
Finding 3(Omitted)
Finding 4(Omitted)

Department Manager B decided to consider improvement measures for the findings in Table 1.

QuestionRegarding finding 1 in Table 1, which of the following is an improvement measure to prevent erroneous changes to FW rules? From the answer group, select the most appropriate one.

Answer group

LearnIPA
Review
History
Profile