Category Archives: C Lang. Skills

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 :-

Continue reading C Lang. Skill Test 2:

C Lang. Skill Test 1 :

Ques 1 :- C is a
A) High level language
B) Low level language
C) High level language with some low level features.
D) Low level language with some high level features.

Ques 2 :- The minimum number of temporary variables needed to swap the contents of two variable is :
A) 1        B) 2      C) 3        D) 0

Ques 3 :- Predict the output of given code.

#include
int main()
{
char arr[50];
printf("%d", scanf("%s", arr));
//Suppose input is "myprogworld".
return 0;
}

A) 11
B) 50
C) 1
D) Garbage Value

Ques 4:- Predict the output of given code.

#include

int main()
{
printf("%c ", 4["HelloWorld !"]);
return 0;
}

A) Runtime Error
B) Compile Time Error
C) W
D) o

Ques 5 :- The purpose of the following program

q = p + q ;
p = q - p;
q = q - p;

A) Transfer the contents of “p” to “q”
B) Transfer the contents of “q” to “p”
C) Exchange the contents of “q” and “p”
D) Negate the contents of “q” and “p”.

Ques 6:- What is the output of given code ?

#include

int main(){
char* ptr = NULL;
free(ptr);
return 0;
}

A) Core dump
B) Undefined
C) Nothing
D) Error

Ques 7 :- printf("%d", printf("helloworld"));

A) Syntax Error
B) helloworld10
C) Garbage value
D) helloworld

Ques 8 :-  printf("%d", printf("%d", 1234));

A) Syntax Error
B) 12341
C) 12344
D) 41234

Answer :->
Continue reading C Lang. Skill Test 1 :