GATE Quiz- (C- Programming)  15-Oct

GATE Quiz- (C- Programming) 15-Oct

University

20 Qs

quiz-placeholder

Similar activities

If else

If else

University

15 Qs

Pointers

Pointers

University

20 Qs

TECHFEST QUALIFYING ROUND

TECHFEST QUALIFYING ROUND

University

20 Qs

C - Strings

C - Strings

University

20 Qs

C programming

C programming

University

15 Qs

C Programming

C Programming

University

20 Qs

OOPS-1

OOPS-1

University

20 Qs

oop with c++

oop with c++

University

20 Qs

GATE Quiz- (C- Programming)  15-Oct

GATE Quiz- (C- Programming) 15-Oct

Assessment

Quiz

Computers

University

Hard

Created by

Hriday Gupta

Used 3+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Consider the following C function.

int fun ( int n ) {


int x = 1, k ;


if ( n == 1) return x ;


for( k = 1 ; k < n ; ++ k )


x = x + fun( k ) * fun( n - k ) ;


return x ;


}

The return value of fun (5) is ________.

GATE CSE 2015 Set 2

49

50

51

52

2.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

GATE CSE 2014 Set 3

Which of the following statements are CORRECT?


1) Static allocation of all data areas by a compiler makes it impossible to implement recursion.


2) Automatic garbage collection is essential to implement recursion.


3) Dynamic allocation of activation records is essential to implement recursion.


4) Both heap and stack are essential to implement recursion.

1 and 2

2 and 3

1 and 3

2 and 4

3.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

GATE CSE 2014 Set 2

int func(int num)


{


int count = 0;


while(num)


{


count++;


num >>= 1;


}


return (count);


}


The value returned by func(435) is _________.

7

8

9

10

4.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

GATE CSE 2014 Set 2

Consider the following function

double f (double x) {

if ( abs (x * x – 3) < 0. 01) return x;

else return f (x / 2 + 1.5/x);

}

Give a value q (to 2 decimals) such that f(q) will return q:______.

2.72

1.72

3.22

6.23

5.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

GATE CSE 2014 Set 2

Consider the C function given below.

int f(int j)

{

static int i = 50;

int k;

if (i == j)

{

printf("something");

k = f(i);

return 0;

}

else return 0;

}

Which one of the following is TRUE?

The function returns 0 for all values of j.

The function prints the string something for all values of j.

The function returns 0 when j = 50.

The function will exhaust the runtime stack or run into an infinite loop when j = 50

6.

FILL IN THE BLANK QUESTION

5 mins • 1 pt

GATE CSE 2013

What is the return value of f (p, p), if the value of p is initialized to 5 before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value.

int f (int &x, int c) {

c = c - 1;

if (c==0) return 1;

x = x + 1;

return f(x,c) * x;

}

7.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

GATE CSE 2003

The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions.

global int i = 100, j = 5;

void P(x) {

int i = 10;

print(x + 10);

i = 200;

j = 20;

print (x);

}

main() {

P(i + j);

}

If the programming language uses static scoping and call by need parameter passing mechanism, the values printed by the above program are

115, 220

25, 220

115, 105

25, 15

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?