Algorithm and Programming
67 questions · Fundamental Engineering · 51–67
When the procedure described below is executed in sequence for an empty stack and empty queue, what is the value assigned to variable x? Here, the functions used in the procedure are defined as follows:
[Procedure]
push(a)
push(b)
enq(pop())
enq(c)
push(d)
push(deq())
x ← pop()
For a function f(x, y) defined below, what is the value of f(775, 527)? Here, x mod y represents the remainder after division of x by y.
f(x, y): if y = 0 then return x else return f(y, x mod y)
The flowchart below shows the algorithm of concatenating two character strings in X and Y, with the resulting character string in Z. Which of the following is the appropriate pair of operations to insert in the blanks, A and B? Here, X and Y are character arrays of dimensions m and n, respectively, where the i-th character of each string is stored as the i-th element of the character array.
Note:
The description in Loop 1 indicates that variable k varies from 1 to m by 1. So does Loop 2.
Data A, B, C and D are entered as an input sequence. Which of the following is a possible output sequence by only using a single stack?
For integers x and y (x > y ≥ 0), a function F(x, y) is defined as follows. What is the value F(231, 15)? Here, x mod y represents the remainder after division of x by y.
In a web environment, which of the following is the name of a program that runs on a web server and achieves dynamic processing?
Which of the following is a binary search tree whose keys are numbers assigned to nodes in natural order?
Function F(n) is a recursively defined integer function that calculates the factorial of n for any non-negative integer n. Which of the following is an appropriate expression for the blank A?
F(0) = 1
F(n) = A (if n > 0)
What is the result of the procedure in the flowchart below, when x and y are positive integers?
In a direct organization file that has a range of storage addresses one (1) through six (6), the data is stored under the conditions below. Which of the following is the key value of the data that is stored in address one (1)?
The flowchart below shows the process of converting a decimal integer j (0 < j < 100) into an 8-digit binary number. The binary number is stored in array elements NISHIN(1) through NISHIN(8), starting from the lowest-order digit. Which of the following is the appropriate combination of processes to be inserted into blanks A and B in the flowchart? Here, j div 2 represents the integer part of the quotient when j is divided by 2, and j mod 2 represents the remainder when j is divided by 2.
(Note) The repetition specification of a loop limit shows variable name: initial value, increment, final value.
When the flowchart in Figure 1 was executed with array A in the state shown in Figure 2, array B came to be in the state shown in Figure 3. Which of the following is the operation to be inserted into blank a in Figure 1? Here, the elements of arrays A and B are A(i, j) and B(i, j), respectively.
Figure 1 Flowchart
(Note) The repetition specification of a loop limit shows variable name: initial value, increment, final value.
Figure 2 State of array A
Figure 3 State of array B after execution
Which of the following is an appropriate item to be specified in the coding standards of a program?
The tree structure in the figure is a binary search tree. Which of the following is the appropriate relationship in magnitude among the values of a through g? Here, no two of the values of a through g are the same.
Data whose key is one lowercase letter of the alphabet (any of a, b, …, z) is stored in a hash table of size 10. As the hash function, the digit in the ones place of the ASCII code of the letter expressed in decimal notation is used. Which of the following is the combination of keys that causes a collision? In ASCII code, consecutive binary numbers in ascending order are assigned as codes in alphabetical order.
In the following flowchart, in order to have the processing executed in the order
① → ② → ③ → ⑤ → ② → ③ → ④ → ② → ⑥
which of the following is the relationship between the initial values a and b that should be given to m and n in ①? Here, a and b are both positive integers.