C Lang. Skill Test 2:

Ques 1:- Consider the function

find(int x, int y)
{
return((x<y)?0:(x-y));
}

What would be the output of the call find(a, find(a,b)); where a, b are two non-negative integers.

A) Sum of a, b
B) Positive difference of a, b
c) Minimum of a, b
D) Maximum of a, b

Ques 2: What would be the output of the given code:

#include<stdio.h>
int main()
{
printf("%d ", main);
return 0;
}

A) Compile time error
B) Run time error
C) Address of main function
D) Random value

Ques 3: In C language , Function parameters are always

A) Passed by Value
B) Passed by Reference
C) Both (A) and (B)

Ques 4: Consider the function :

#include<stdio.h>
void alpha(char ch)
{
while(ch++ <= 'z')
putchar(var);
}

let suppose call is alpha(p) in the main function, where char p=’a’.
if the required output is abcdefghijklmnopqrstuvwxyz , then var should be

A) ch     B) ch++     C) ch-1     D) -ch

Answers :-


Ans 1 :-     C
Ans 2 :-     C
Ans 3 :-     A
Ans 4 :-     C

Leave a comment