# AMCAT Previous Years Questions on Miscellaneous : Procedure, functions and scope

### Topics Sub- Topics Expected Questions Basic Programming Data Types Iteration, Recursion, Decision Procedure, functions and scope 10 – 12 Questions Data Structures Arrays, Linked Lists, Trees, Graphs Stacks, Queues Hash Tables Heaps 6 – 8 Questions OOPs Polymorphism Abstraction Encapsulation 4 – 6 Questions Miscellaneous Searching and Sorting Complexity Theory Core Computer Science 4 – 5 Questions

Question 1
The default parameter passing mechanism is
A. call by value
B. call by reference
C. call by value-result
D. None of these.

Question 2
Determine output:
main()
{
int i = 5;
printf(“%d%d%d%d%d”, i++, i–, ++i, –i, i);
}

A. 5454
B. 45445
C. 54554
D. 45545

Question 3
What will be printed when this program is executed?
int f(int x)
{
if(x <= 4)
return x;
return f(–x);
}
void main()
{
printf(“%d “, f(7));
}
A. 4 5 6 7
B. 1 2 3 4
C. 4
D. Syntax error
E. Runtime error

In this recursive function call the function will return to main caller when the value of x is 4. Hence the output.

Question 4
Which of the following function calculates the square of ‘x’ in C?
A. sqr(x)
B. power(x, 2)
C. power(2, x)
D. pow(x, 2)
E. pow(2, x)

Question 5
char* myfunc(char *ptr) { ptr+=3; return(ptr); } void main() { char *x, *y; x = “PrepInsta”; y = myfunc(x); printf(“y=%s”, y); } What will be printed when the sample code above is executed?
A. y=PrepInsta
B. y=pInsta
C. y=Insta
D. y=nsta
E. y=epInsta

Question 6
#include <stdio.h>
extern int var;
int main()
{
var = 10;
printf(“%d “, var);
return 0;
}
A. 20
B. 0
C. compiler error