LearnIPAReviewHistory
Profile
AboutHow I passedUse with AIFeedback
LearnIPA
Review
History
Profile
LearnIPAReviewHistory
Profile
AboutHow I passedUse with AIFeedback
FE-B 2024 Spring

ITPEC FE Subject B April 2024 — Question 1 of 20

Question 1

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

A school determines the letter grade that a student will receive based on the score, which is an integer value between 0 and 100, as follows:

ScoreLetter gradeDescription
80 – 100DPass with distinction
50 – 79PPass
0 – 49FFail

The function grade receives a score (non-negative integer value between 0 and 100) and returns the letter grade as a character.

[Program]
○ character: grade(integer: score)
character: ret
if (score A 80)
ret ← "D"
elseif (score A 50)
ret ← B
else
ret ← C
endif
return ret

Answer group

OptionABC

ITPEC FE Subject B April 2024 — Question 2 of 20

Question 2

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

A bus company operates buses between two cities. The standard ticket price is 20 US dollars and the discount ticket price for passenger aged 10 and under or aged 60 and over is 10 US dollars. Additionally, registered members of all ages always get the ticket at the discount price.

The function ticketPrice receives the arguments age (a non-negative integer value) and isMember (a boolean indicating that the passenger is a member if the value is true), which returns the value ret as the ticket price (in US dollars).

[Program]
○ integer: ticketPrice(integer: age, boolean: isMember)
integer: ret
if (blank)
ret ← 10
else
ret ← 20
endif
return ret

Answer group

ITPEC FE Subject B April 2024 — Question 3 of 20

Question 3

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

The program outputs the even numbers between 1 and 100. Subsequently, it prints the sum of those even numbers. Note that division is performed for data type integer, that is, a ÷ b is the quotient of a divided by b.

[Program]
integer: i
integer: sum ← 0
for(increase i from 1 to 100 by 1)
if(blank)
output i
sum ← sum + i
endif
endfor
output sum

Answer group

ITPEC FE Subject B April 2024 — Question 4 of 20

Question 4

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

The function sumDigits receives a non-negative integer value num as argument, and returns the sum of the digits of num.

[Program]
○ integer: sumDigits(integer: num)
integer: sum ← 0
while (num > 0)
sum ← A
num ← B
endwhile
return sum

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 5 of 20

Question 5

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

The function division receives two integer values a and b and returns the quotient of a divided by b. The function modulus receives two integer values a and b and returns the remainder of a divided by b. The procedure convert receives the value of seconds as the input argument and outputs that value in the form of hours, minutes, and seconds. For example, when the procedure convert is called as convert(5450) the output is “1, 30, 50”. Here, suppose that the range of input values satisfy 0 ≤ input < 86400.

[Program]
○ convert(integer: input)
integer: hour, minute, second
second ← modulus(input, 60)
minute ← A
hour ← B
output hour, minute, second
○ integer: division(integer: a, integer: b)
integer: u
u ← integer part of (a ÷ b)
return u
○ integer: modulus(integer: a, integer: b)
integer: u
u ← a mod b
return u

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 6 of 20

Question 6

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

The function count1 receives the bit8 type (8-bit type) argument byte, and returns the number of bits 1 in the argument. For example, when the function count1 is called as count1(11001011), the return value is 5.
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, v << n performs a logical shift of the value of v by n bits to the left.

[Program]
○ integer: count1(bit8: byte)
bit8: rbyte ← byte
integer: r ← 0
integer: i
for (increase i from 1 to 8 by 1)
if ((blank) ≠ 00000000)
r ← r + 1
endif
endfor
return r

Answer group

ITPEC FE Subject B April 2024 — Question 7 of 20

Question 7

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

The Fibonacci sequence is a sequence in which each number is equal to the sum of the two preceding numbers. In this question, the sequence starts with 0 and 1. The first 10 values in the sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34. For example, the 8-th number 13 is the sum of the two preceding numbers 5 and 8.

The function fibo takes an integer value n as the argument and returns the value at the n-th position. Here, n reflects the position of the number in the sequence, starting with 1 (one). When n is 9, the function returns 21.

[Program]
○ integer: fibo(integer: n)
if (A)
return n - 1
else
return B
endif

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 8 of 20

Question 8

From the answer group below, select the correct combination of answers to be inserted into A through C in the program. Here, the array index starts at 1.

The program implements a stack. The stack implementation only accepts positive integers. The function empty checks whether the stack is empty. The function full checks whether the stack is full. If the stack is not full, the function push pushes an element with a specified value onto the stack. If the stack is not empty, the function pop removes an element from the stack and returns its value. In the program, areas outside of the array must not be referenced.

[Program]
global: integer []: content
← {undefined, undefined, undefined, undefined}
global: integer: index ← 1
global: integer: max ← 4 /* max size of the stack */
○ boolean: empty()
if (index = 1)
return true
else
return false
endif
○ boolean: full()
if (A)
return true
else
return false
endif
○ boolean: push(integer: i)
if (not full())
content[index] ← i
index ← B
return true
else
return false
endif
○ integer: pop()
if (not empty())
index ← C
return content[index]
else
return -1
endif

Answer group

OptionABC

ITPEC FE Subject B April 2024 — Question 9 of 20

Question 9

From the answer group below, select the correct combination of answers to be inserted into A through C in the program. Here, the array index starts at 1.

The procedure preorder traverses a binary tree and outputs the value of each node by following the sequence: root, left subtree, and right subtree using a stack (Last In, First Out). Each node of the binary tree is represented by the class Node. The table shows the description of the class Node. The Node-type variable holds a reference to an instance of the class Node. The argument root holds a reference to the root of the binary tree, which is an instance of the class Node. In the program, areas outside of the array must not be referenced.

Table Class Node

Member variableTypeDescription
infocharacterCharacter type value to be stored in a node of a binary tree.
leftNodeA reference to the left child of a binary tree. If there is no left child, the status is undefined
rightNodeA reference to the right child of a binary tree. If there is no right child, the status is undefined
[Program]
○ preorder(Node: root)
Node []: stack ← {undefined, ···, undefined}
// an array with sufficient number of elements
Node: v
integer: sp ← 1 // The stack pointer
stack[sp] ← root // Push root to the stack
while (sp is not A)
v ← stack[sp] // Pop an element from the stack
output v.info
sp ← sp - 1
if (B is not undefined)
sp ← sp + 1
stack[sp] ← B
endif
if (C is not undefined)
sp ← sp + 1
stack[sp] ← C
endif
endwhile

Answer group

OptionABC

ITPEC FE Subject B April 2024 — Question 10 of 20

Question 10

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

The procedure Insert inserts an integer number given by the argument after the last element of the linear circular linked list. Each element of the linear circular linked list is represented by the class ListElement. The figure shows the description of the class ListElement. The ListElement-type variable holds a reference to an instance of the class ListElement. The global variable listHead holds a reference to the head element of the linear circular linked list. Remember that in the circular linked list the last element points to the listHead. Here, if the list is empty, listHead is set to undefined.

Member variableTypeDescription
valintegerThe value of an element.
nextListElementReference to the instance that holds the next element in the list.
ConstructorDescription
ListElement(integer: newItem)Initialize the member variable val with the argument newItem.

Figure Class ListElement

[Program]
global: ListElement: listHead ← undefined
○ Insert(integer: newItem)
ListElement: tmp, newNode
newNode ← ListElement(newItem)
if (listHead is undefined)
listHead ← newNode
listHead.next ← listHead
else
tmp ← listHead
while (tmp.next is not A)
tmp ← B
endwhile
tmp.next ← newNode
newNode.next ← listHead
endif

Answer group

OptionAB
Questions 11–20

ITPEC FE Subject B April 2024 — Question 11 of 20

Question 11

From the answer group below, select the correct combination of answers to be inserted into A through C in the program. Here, the array index starts at 1.

The program sorts the data in ascending order using the selection sort algorithm. The algorithm repeatedly selects the smallest element from the unsorted portion of the array and swaps it with the first element of the unsorted portion until the entire array is sorted.

[Program]
integer []: data ← {12, 11, 13, 5, 6}
integer: i, j, temp, minPos
integer: size ← the number of elements in data
for (increase i from 1 to (size - 1) by 1)
minPos ← i
for (increase j from A to size by 1)
if (data[j] B data[minPos])
minPos ← j
endif
endfor
temp ← C
C ← data[minPos]
data[minPos] ← temp
endfor

Answer group

OptionABC

ITPEC FE Subject B April 2024 — Question 12 of 20

Question 12

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

A string of character(s) is called a palindrome if it reads the same forwards and backwards. Here the input string consists of only the uppercase Roman alphabet. As an example, the string "MADAM" is a palindrome as it remains the same when written backwards (right to left). The procedure isPalindrome receives a string str as a parameter and outputs whether the string str is a palindrome or not. The procedure should use the minimum number of iterations for any number of characters in the string. Note that division is performed for data type integer, that is, a ÷ b is the quotient of a divided by b.

[Program]
○isPalindrome(string: str)
integer: i, j, len
boolean: flag
flag ← true
len ← number of characters in str
i ← 1
j ← len
while (blank)
if (the i-th character of string str ≠ the j-th character of string str)
flag ← false
exit the while block
endif
i ← i + 1
j ← j - 1
endwhile
if (flag)
output str, " is a palindrome."
else
output str, " is not a palindrome."
endif

Answer group

ITPEC FE Subject B April 2024 — Question 13 of 20

Question 13

From the answer group below, select the correct combination of answers to be inserted into A through C in the program. Here, the array index starts at 1.

The function are_brackets_balanced checks for balanced brackets. It parses the given array of characters and when an opening bracket (“(”, “[”, “{”) is encountered, this is pushed onto the stack. When a closing bracket (“)”, “]”, “}”) is encountered, an element is popped from the stack and tested if it corresponds to the opening bracket. If the closing bracket matches its corresponding opening bracket, the process continues. Otherwise, it fails and the function returns false. After all characters have been processed, it returns false if any characters remain on the stack, otherwise it returns true. For simplicity, only brackets are considered as arguments to the function. The table shows examples of arguments provided to are_brackets_balanced and the return values.

Table Examples of arguments provided to the function are_brackets_balanced and the return values

Function callReturn value
are_brackets_balanced({"(", "{", "}", ")", "[", "]"})true
are_brackets_balanced({"(", "{", "}", "[", "]"})false
are_brackets_balanced({"(", "{", ")", "}", "[", "]"})false

The function are_brackets_balanced uses class Stack. The figure describes class Stack.

ConstructorDescription
Stack()Initialize a stack.
MethodReturn valueDescription
push(character: arg)NonePushes arg onto the stack.
pop()characterReturns the value popped from the stack.
isEmpty()booleanReturns true if the stack is empty.

Figure Class Stack

[Program]
global: character [][]: brackets ← {
{"(", ")"},
{"{", "}"},
{"[", "]"}
}
○ boolean: are_brackets_balanced(character[]: expr)
Stack: stack ← Stack()
character: c, stacked_bracket
for (c in expr)
if (is_opening_bracket(c))
stack.push(c)
else
if (stack.isEmpty())
return false
endif
stacked_bracket ← stack.pop()
if (get_closing_bracket(stacked_bracket) A)
return false
endif
endif
endfor
return B
○ boolean: is_opening_bracket(character: c)
character []: chars
for (chars in brackets)
if (chars[1] = c)
return true
endif
endfor
return false
○ character: get_closing_bracket(character: c)
character []: chars
for (chars in brackets)
if (chars[1] = c)
return C
endif
endfor
return undefined

Answer group

OptionABC

ITPEC FE Subject B April 2024 — Question 14 of 20

Question 14

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 calcSim takes two vectors (arrays) as input, calculates their similarity, and returns a value that characterizes the similarity. A large similarity indicates that the vectors are similar, and a small similarity indicates that the vectors are dissimilar. For example, to quantify the similarity between two documents, you can create a vector of occurrences of some words for each of the two documents and input them into calcSim. When the function calcSim({2, 2, 1, 0, 4}, {3, 1, 1, 1, 2}) is called, the return value rounded to the first decimal place is blank.

[Program]
// Assume that arrays v1 and v2 have the same number of one or more elements
// and that the arrays are not all-zero.
○ real: calcSim(integer []: v1, integer []: v2)
integer: i, x, y
integer: sxx ← 0
integer: syy ← 0
integer: sxy ← 0
for (increase i from 1 to the number of elements in v1 by 1)
x ← v1[i]
y ← v2[i]
sxx ← sxx + x × x
syy ⟵ syy + y × y
sxy ⟵ sxy + x × y
endfor
return sxy ÷ (square root of (sxx × syy))

Answer group

ITPEC FE Subject B April 2024 — Question 15 of 20

Question 15

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.

N-grams are continuous sequences of words, symbols, or tokens in a document. N-grams of texts are extensively used in text mining and natural language processing tasks. An n-gram model is built by counting how often word sequences occur in corpus text and then estimating the probabilities. The figure shows an example of the unigrams, bigrams, and trigrams of the example sentence “ITPEC includes members from 6 countries.”

unigramITPECincludesmembersfrom6countriesbigramITPEC includesincludes membersmembers fromfrom 66 countriestrigramITPEC includes membersincludes members frommembers from 6from 6 countries

Figure Example of unigrams, bigrams, and trigrams

The procedure NGRAMS generates n-grams from text and outputs them. If the argument for n is 1, the procedure outputs the unigram result. If n is 2, the procedure outputs the bigram result and so on. The input text is a string of words separated by a space, so it is needed to split the string to generate n-grams. The table shows the description of the functions used in the program. In this question, the operator “+” is used for both arithmetic calculation of integer data type and concatenation of one or more strings into one string. In the program, areas outside of the array must not be referenced.

Table Functions

FunctionReturn valueDescription
split(string: str)string []Returns the words that are separated with a space in the text str
[Program]
○ NGRAMS(integer: n, string: text)
string []: words ← split(text)
string: s
integer: i, j, length
length ← the number of elements in words
for (increase i from 1 to (A) by 1)
s ← ""
for (increase j from i to (B) by 1)
s ← s + words[j] + " "
endfor
output s
endfor

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 16 of 20

Question 16

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

The function m_sin calculates and returns the approximate value of sin(x) for the argument x using the Maclaurin expansion. The program calculates sin(x) using the approximate formula below:

sin(x) = x/1! - x3/3! + x5/5! - … + (-1)n × ( x(2n+1)/(2n+1)!)

Here, ! is the factorial symbol, and n is the first integer for which | x(2n+1) / (2n+1)! | ≤ 10-7 is satisfied.

[Program]
○ real: m_sin(real: x)
real: vn ← x
real: k ← 1
real: sum ← vn
real: epsi ← 1×10⁻⁷
while (abs(vn) A) // abs(vn) returns the absolute value of vn
k ← k + 2
vn ← B
sum ← sum + vn
endwhile
return sum

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 17 of 20

Question 17

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

An information systems company S has a guideline related to any issue for workers doing their daily job. The company has an information security team responsible for related issues and updates workers’ knowledge on information security.

One morning, a company worker who had just started his daily job and successfully signed into the company’s enterprise system received the following email:

From: Administration Department StaffTo: To whom it may concernSubject: Action Required: Please update your bank account information. This email has been sent to employees who failed to receive their paychecks because their bank account information is incorrect. Please use the link below to update your account information ASAP. Please complete the update by noon today to receive your next paycheck in time. Link: https://www.example.com/​company-s/​paycheck&param=xnt6a5mv9YeKK1

Soon, the worker realized that something wrong. He followed the guideline instead of clicking on the link in the email because he suspected this is a A attack, and it is typically conducted through B. He also informed the company’s information security team to deal with the issue.

A few days later, the worker received an email from the information security team leader. The email was to notify that the issue was resolved, thanking the worker for his responsibility in handling the case according to the guideline.

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 18 of 20

Question 18

From the answer group below, select the most appropriate combination of answers to be inserted into A through C in Table 1.

Company X is a small trading company. The company is about to provide a new e-commerce web site for customers to make purchases online. The company will also hosts its own email service for the employees to conduct business with partners and customers. Company X will utilize public key infrastructure (PKI) to provide security for both the web server and email service. PKI uses public key cryptography to manage the identity of servers or persons and is widely used on the Internet.

Mr. T, the IT support person of company X is assigned to prepare the web server and email service in accordance with the following requirements:

  • •The e-commerce web application will run on the web server that is certified by a third-party certification authority. All connections to the web server will be secured using HTTPS.
  • •The staff directory along with the contact information will be published on the web site to enable business partners and customers to use the information to securely communicate with employees of company X.

The actions taken by Mr. T are shown in Table 1.

Table 1 Actions taken by Mr. T

NoAction
1To enable secure and trusted connections to the web server, Mr. T submits the web server certificate along with the A to the third-party certification authority. The certification authority signs the certificate with its own private key. Then, he installs the signed certificate on company X’s web server.
2To allow business partners and customers to send encrypted email messages to particular contacts in company X, Mr. T publishes the B along with the employee’s information in the staff directory on company X’s web site.
3To send digitally signed email messages to partners and customers, the employees of company X are required to install the C on their email clients. Therefore, Mr. T provides support to the employees who require assistance.

Answer group

OptionABC

ITPEC FE Subject B April 2024 — Question 19 of 20

Question 19

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

Company Y is an online retailer providing e-commerce web applications for customers to make purchases online and also allows customers to post product reviews. The web application was developed and maintained in-house. The properties of the e-commerce web application are shown in Figure 1.

•The web application resides on the web server in the demilitarized zone (DMZ), and the database used by the web application resides on the database server in the internal network.•The firewall is properly configured, the customers can only access the web server in the DMZ, and the database can only be accessed from the web server.•The web server allows access only through the HTTPS service, and the certificate is properly configured.•The customers can login using their registered email address and password.•The password is hashed and stored on the database.•The customer is locked out and notified by email with a recovery link if there are 5 consecutive incorrect login attempts.•Third-party payment gateways are used to perform financial transactions. The credit card information of customers is not stored in the database.•There is a password recovery system which allows the customer to reset the password through a password recovery link sent to the registered email address.

Figure 1 Properties of the e-commerce web application

Due to recent incidents with multiple customers reporting that their accounts were compromised, the management tasked the IT team to investigate and address the issues. The IT team found that many customer accounts logins were unnoticed by the actual account owners, and some of the accounts were used to post fake reviews. The IT team also discovered unauthorized access to the database with illegal queries executed with no trace of administration login.

The IT team concluded that the incidents are most likely caused by using the same password on other leaked sites and A. They proposed to implement 2-factor authentication and B to mitigate respective issues in the future. The management then agreed to the plan, and the solutions was implemented accordingly.

Answer group

OptionAB

ITPEC FE Subject B April 2024 — Question 20 of 20

Question 20

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

A zone is a group of interfaces that have similar functions or features. Zones establish the security borders of a network. A zone defines a boundary where traffic is subjected to policy restrictions when crossing into another region of a network. An inspection policy is applied to traffic moving between zones. Inter-zone policies offer considerable flexibility. Hence, different inspection policies can be applied to multiple host groups connected to the same router interface.

Company Z, intends to apply a zone-based policy firewall in their datacenter. Thus, they develop the network topology shown in Figure 1.

The InternetPRIVATE zonePC-1PC-nPUBLIC zoneDMZ zoneServer-1Server-n

Figure 1 Network topology

These zones have the following characteristics:

  • •The DMZ zone represents a zone where servers accessed from the Internet are located. Even if a server in the DMZ zone is breached, direct access to the internal PCs of the datacenter is prevented.
  • •The PUBLIC zone represents the entire network outside the datacenter.
  • •The PRIVATE zone represents the internal network. All datacenter PCs are located in this zone.

The security policy for the datacenter should be:

  • •Hosts in the A zone cannot connect to hosts in the B zone.
  • •Hosts in the A zone can only access the DNS service on all hosts in the C zone and HTTP/HTTPS service on limited hosts in the C zone to retrieve software updates.
  • •Hosts in the B zone can connect to hosts in the A zone on all TCP, UDP and ICMP services.
  • •Hosts in the B zone can reach the C zone but not vice versa.
  • •Hosts in the C zone can reach HTTPS service on hosts in the A zone. This policy will restrict access to other services available on each server.

Answer group

OptionABC
LearnIPA
Review
History
Profile