
GATE Quiz- (C- Programming) 15-Oct

Quiz
•
Computers
•
University
•
Hard
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
Similar Resources on Wayground
16 questions
C-Extended

Quiz
•
University
15 questions
ARRAYS AND FUNCTIONS

Quiz
•
University
16 questions
PSC ALM QUIZ

Quiz
•
University
15 questions
Java Method

Quiz
•
University
20 questions
Java, part I

Quiz
•
11th Grade - University
16 questions
A "C" Event-the backbone of modern coding.

Quiz
•
University
20 questions
C++ Quiz

Quiz
•
University
20 questions
C - Structures

Quiz
•
University
Popular Resources on Wayground
12 questions
Unit Zero lesson 2 cafeteria

Lesson
•
9th - 12th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
20 questions
Lab Safety and Equipment

Quiz
•
8th Grade
13 questions
25-26 Behavior Expectations Matrix

Quiz
•
9th - 12th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
15 questions
Let's Take a Poll...

Quiz
•
9th Grade - University
2 questions
Pronouncing Names Correctly

Quiz
•
University
12 questions
Civil War

Quiz
•
8th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University
21 questions
Mapa países hispanohablantes

Quiz
•
1st Grade - University
19 questions
Primary v. Secondary Sources

Quiz
•
6th Grade - University
25 questions
Identifying Parts of Speech

Quiz
•
8th Grade - University
20 questions
Disney Trivia

Quiz
•
University