Questions 251–260 of 975. Imported answers require independent review unless marked reviewed.

Topic practice 975 questionsPage 26 of 98

Question 61

Open question
CSNAT2 marksNeeds review
#include<stdio.h> int foo(int s[],int size){ if(size == 0) return 0; if(size == 1) return 1; if(s[0] != s[1]) return 1+foo(s+1,size-1); return foo(s+1,size-1); } int main(){ int A[]={0,1,2,2,0,0,1,1}; printf("%d",foo(A,8)); return 0; }

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
An application executes

number of instructions in 6.3 seconds. There are four types of instructions, the details of which are given in the table. The duration of a clock cycle in nanoseconds is __________. (rounded off to one decimal place)
Instruction type
Clock cycles required per instruction (CPI)
Number of instructions executed
Branch
2

Load
5

Store
4

Arithmetic
3


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
Let LIST be a datatype for an implementation of linked list defined as follows: typedef struct list { int data; struct list *next; } LIST;
Suppose a program has created two linked lists, L1 and L2, whose contents are given in the figure below (code for creating L1 and L2 is not provided here). L1 contains 9 nodes, and L2 contains 7 nodes.
Diagram for Computer Science and Information Technology question 62

Consider the following C program segment that modifies the list L1. The number of nodes that will be there in L1 after the execution of the code segment is ______ . (Answer in integer)
int find (int query, LIST *list) { while (list != NULL){ if(list->data == query) return 1; list = list->next; } return 0; } int main () { ... ... ... ptr1=L1; ptr2=L2; while (ptr1->next != NULL){ query = ptr1->next->data; if (find (query, L2)) ptr1->next = ptr1->next->next; else ptr1 = ptr1->next; } ... ... ... return 0; }

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
Consider the following C program:
#include <stdio.h>

int main(){
int a;
int arr[5] = {30,50,10};
int *ptr;
ptr = &arr[0] + 1;
a = *ptr;
(*ptr)++;
ptr++;
printf("%d", a + (*ptr) - arr[1]);
return 0;
}
The output of the above program 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 C program:
#include<stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t = 10; t /=10; while (t>0) { d = n/t; n = n%t; t /= 10; if (turn) newnum = 10newnum + d; turn = (turn + 1) % 2; } return newnum; } int main () { printf("%d", gate(14362)); return 0; } The value printed by the given C program 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 C program:
#include <stdio.h>
int g(int n) {
return (n+1);
}
int f(int n) {
return g(n*2);
}
int main() {
int sum, n;
sum=0;
for (n=1; n<3; n++)
sum += g(f(n));
printf ("%d", sum);
return 0;
}
The output of the given C program 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 64

Open question
CSNAT2 marksNeeds review
The maximum value of x such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is ______ . (answer in integer)
Diagram for Computer Science and Information Technology question 64


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
A quadratic polynomial

over complex numbers is said to be square invariant if

. Suppose from the set of all square invariant quadratic polynomials we choose one at random.
The probability that the roots of the chosen polynomial are equal 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 65

Open question
CSNAT2 marksNeeds review
In a double hashing scheme,

and

are the auxiliary hash functions. The size

of the hash table is 11. The hash function for the i-th probe in the open address table is

. The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.
The slot at which key 24 gets stored 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 65

Open question
CSNAT2 marksNeeds review
The unit interval (0,1) is divided at a point chosen uniformly distributed over (0,1) in ℝ into two disjoint subintervals.
The expected length of the subinterval that contains 0.4 is __________. (rounded off to two decimal places)

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