Questions 921–930 of 975. Imported answers require independent review unless marked reviewed.

Topic practice 975 questionsPage 93 of 98

Question 38

Open question
CSMCQ2 marksNeeds review
Consider the following C function.
int fun(int n) { int i, j; for(i = 1; i<= n; i++) { for(j = 1; j < n; j += i) { printf("%d %d", i, j); } } }
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 39

Open question
CSMCQ2 marksNeeds review
Let

and

be finite alphabets and let

be a symbol outside both

and

. Let

be a total function from

to

. We say

is computable if there exists a Turing machine

which given an input

in

, always halts with

on its tape. Let

denote the language

. Which of the following statements is true:
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 39

Open question
CSMCQ2 marksNeeds review
Let δ denote the transition function and δ̂ denote the extended transition function of the ε-NFA whose transition table is given below:
δ
ε
a
b
→ q₀
{q₂}
{q₁}
{q₀}
q₁
{q₂}
{q₂}
{q₃}
q₂
{q₀}
∅
∅
q₃
∅
∅
{q₂}
Then δ̂(q₂, aba) is
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 40

Open question
CSMCQ2 marksNeeds review
Recall that Belady’s anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:
S1: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady’s anomaly S2: LRU page replacement algorithm suffers from Belady’s anomaly
Which of the following is CORRECT?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 40

Open question
CSMCQ2 marksNeeds review
Consider the following languages:
L₁ = {aᵖ | p is a prime number} L₂ = {aⁿbᵐc²ᵐ | n ≥ 0, m ≥ 0} L₃ = {aⁿbⁿc²ⁿ | n ≥ 0} L₄ = {aⁿbⁿ | n ≥ 1}
Which of the following are CORRECT?
I. L₁ is context-free but not regular. II. L₂ is not context-free. III. L₃ is not context-free but recursive. IV. L₄ is deterministic context-free.
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 41

Open question
CSMCQ2 marksNeeds review
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.
(I)

(II)

(III)

Which of the above queries are safe?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 41

Open question
CSMCQ2 marksNeeds review
Let L(R) be the language represented by regular expression R. Let L(G) be the language generated by a context free grammar G. Let L(M) be the language accepted by a Turing machine M. Which of the following decision problems are undecidable?
I. Given a regular expression R and a string w, is w ∈ L(R)? II. Given a context-free grammar G, is L(G) = ∅? III. Given a context-free grammar G, is L(G) = Σ* for some alphabet Σ? IV. Given a Turing machine M and a string w, is w ∈ L(M)?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 42

Open question
CSMCQ2 marksNeeds review
In a database system, unique timestamps are assigned to each transaction using Lamport’s logical clock. Let

and

be the timestamps of transactions

and

respectively. Besides,

holds a lock on the resource R, and

has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
if

then

is killed
else

waits.
Assume any transaction that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 42

Open question
CSMCQ2 marksNeeds review
The next state table of a 2-bit saturating up-counter is given below.
Q₁
Q₀
Q₁⁺
Q₀⁺
0
0
0
1
0
1
1
0
1
0
1
1
1
1
1
1
The counter is built as a synchronous sequential circuit using T flip-flops. The expressions for T₁ and T₀ are
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 43

Open question
CSNAT2 marksNeeds review
Consider the following grammar:
stmt

if expr then expr else expr; stmt

ò
expr

term relop term

term
term

id

number
id

a

b

c
number

[0-9]
where relop is a relational operator (e.g.,<, >, …), ò refers to the empty statement, and if, then, else are terminals.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer