Questions 21–30 of 281. Imported answers require independent review unless marked reviewed.

Topic practice 281 questionsPage 3 of 29

Question 60

Open question
CSNAT2 marksNeeds review
The EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let

denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of

and

(the number of instructions of that type in a sequence of 100 instructions for a program P), are given in the table below. The duration of the pipeline clock cycle is 1 nanosecond. Assume that the latch time for the interstage buffers in the pipeline is negligible. Table (Instruction,

in nanoseconds,

): LOAD, 1.8, 15; MUL, 1.5, 10; IDIV, 2.5, 5; FADD, 1.7, 10; FSUB, 1.7, 5; FMUL, 2.8, 15; FDIV, 3.2, 5; All other instructions, Less than 1.0, 35. When program P is executed, the number of clock cycles for which the pipeline is stalled due to structural hazards in the EX stage is _____. (answer in integer)

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 60

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

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 61

Open question
CSNAT2 marksNeeds review
Consider the recursive functions represented by the following code segment:
int bar(int n){
if (n == 1) return 0;
else return 1 + bar(n/2);
}

int foo(int n){
if (n == 1) return 1;
else return 1 + foo(bar(n));
}
The smallest positive integer

for which foo(n) returns 5 is _____. (answer in integer)
Note: Ignore syntax errors (if any) in the function.

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 61

Open question
CS2NAT2 marksNeeds review
Consider the following ANSI-C function.
int func(int start, int end){
int length=end+1-start;
if((length<1)||(start<0)||(end<0)){ return(0); }
if(length%3==0){
return(func(start+1, end));
} else if(length%3==1){
return(1+func(start, end-1));
} else {
return(func(start+2, end));
}
}
The maximum possible value that can be returned from this function is __________. (answer in integer)
Note: Ignore syntax errors (if any) in the function.

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 62

Open question
CSNAT2 marksNeeds review
The following sequence corresponds to the preorder traversal of a binary search tree

:
50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77
The position of the element 60 in the postorder traversal of

is _____. (answer in integer)
Note: The position begins with 1.

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 62

Open question
CS2NAT2 marksNeeds review
The determinant of a 4 × 4 matrix A is 3. The value of the determinant of 2A is __________. (answer in integer)

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 63

Open question
CSNAT2 marksNeeds review
Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the fork() system call is always successful in creating a process.
int main () {
int i;
for (i = 0; i < 3; i++){
if (fork() == 0)
continue;
break;
}
printf("Hello!");
return 0;
}
The total number of times that the printf statement gets executed is ________. (answer in integer)

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 63

Open question
CS2NAT2 marksNeeds review
Suppose an unbiased coin is tossed 6 times. Each coin toss is independent of all previous coin tosses. Let E_1 be the event that among the second, fourth, and sixth coin tosses, there are at least two heads. Let E_2 be the event that among the first, second, third, and fifth coin tosses, there are equal number of heads and tails.
The conditional probability P(E_1|E_2) is equal to __________. (rounded off to one decimal place)

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 64

Open question
CSNAT2 marksNeeds review
Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst of 8 seconds. A new process of type A arrives at time

and

(in seconds). Similarly, a new process of type C arrives at time

and

(in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at

seconds. The average waiting time (in seconds) for the 10 processes is __________. (rounded off to one decimal place)

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 64

Open question
CS2NAT2 marksNeeds review
Consider a function

defined as follows.
For a real number

,

if the second digit after the decimal point in

is one of the four digits 2, 3, 6 and 7. Otherwise,

is equal to 0.
The number of points in (0,1) at which

is discontinuous is __________. (answer in integer)

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