Questions 631–640 of 975. Imported answers require independent review unless marked reviewed.

Topic practice 975 questionsPage 64 of 98

Question 46

Open question
CSMSQ2 marksNeeds review
Consider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and counter is a shared variable initialized to 0 in line#1. Assume that the increment operation in line#7 is not atomic.
int counter = 0;
Semaphore S = init(5);
void parop(void)
{

wait(S);

wait(S);

counter++;

signal(S);

signal(S);
} If five threads execute the function parop concurrently, which of the following program behavior(s) is/are possible?
Your answerSelect all correct options. You can choose more than one.

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 46

Open question
CSMSQ2 marksNeeds review
Consider the following directed graph:
Diagram for Computer Science and Information Technology question 46

Which of the following is/are correct about the graph?
Your answerSelect all correct options. You can choose more than one.

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 47

Open question
CSMSQ2 marksNeeds review
Consider a dynamic hashing approach for 4-bit integer keys:
There is a main hash table of size 4.
The 2 least significant bits of a key is used to index into the main hash table.
Initially, the main hash table entries are empty.
Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table entry is organized as a binary tree that grows on demand.
First, the 3rd least significant bit is used to divide the keys into left and right subtrees.
To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on the 4th least significant bit.
A split is done only if it is needed, i.e., only when there is a collision. Consider the following state of the hash table.
Diagram for Computer Science and Information Technology question 47

Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?
Your answerSelect all correct options. You can choose more than one.

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 47

Open question
CSMSQ2 marksNeeds review
Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string

is divisible by three.
Your answerSelect all correct options. You can choose more than one.

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 48

Open question
CSNAT2 marksNeeds review
Consider the following ANSI C function:
int SimpleFunction(int Y[], int n, int x)
{
int total = Y[0], loopIndex;
for (loopIndex = 1; loopIndex <= n - 1; loopIndex++)
total = x * total + Y[loopIndex];
return total;
}
Let

be an array of 10 elements with

, for all

such that

. The value returned by SimpleFunction(Z, 10, 2) is __________.

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 48

Open question
CSNAT2 marksNeeds review
Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below.
Diagram for Computer Science and Information Technology question 48

The page size is 4KB (1KB =

bytes) and page table entry size at every level is 8 bytes. A process

is currently using 2GB (1GB =

bytes) virtual memory which is mapped to 2GB of physical memory. The minimum amount of memory required for the page table of

across all levels is ______ KB.

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 49

Open question
CSNAT2 marksNeeds review
Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following:
The time taken for processing the data frame by the receiver is negligible.
The time taken for processing the acknowledgement frame by the sender is negligible.
The sender has infinite number of frames available for transmission.
The size of the data frame is 2,000 bits and the size of the acknowledgement frame is 10 bits.
The link data rate in each direction is 1 Mbps (=

bits per second).
One way propagation delay of the link is 100 milliseconds.
The minimum value of the sender’s window size in terms of the number of frames (rounded to the nearest integer) needed to achieve a link utilization of 50% is __________.

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 49

Open question
CSNAT2 marksNeeds review
Consider the following ANSI C program.
#include <stdio.h>

int foo(int x, int y, int q)
{
if ((x <= 0) && (y <= 0))
return q;
if (x <= 0)
return foo(x, y-q, q);
if (y <= 0)
return foo(x-q, y, q);
return foo(x, y-q, q) + foo(x-q, y, q);
}

int main()
{
int r = foo(15,15,10);
printf("%d", r);
return 0;
}
The output of the program upon execution is ______.

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 50

Open question
CSNAT2 marksNeeds review
Consider the following C code segment:
a = b + c;
e = a + 1;
d = b + c;
f = d + 1;
g = e + f;
In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes in the DAG is __________.

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 50

Open question
CSNAT2 marksNeeds review
Let

be a set consisting of 10 elements. The number of tuples of the form

such that

and

are subsets of

, and

is ____________.

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