Algorithm and Programming
61 questions · Fundamental Engineering · 51–61
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)?