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 :->
Answer 1:-
C
Answer 2:-
D

//Let a=3, b=2
a=a+b;  //a=5
b=a-b;  //b=3
a=a-b;  //a=2

Answer 3:-
C
“In C, scanf returns the no. of inputs it has successfully read.”

Answer 4:-
D

4[“HelloWorld !”]
becomes *(4+HelloWorld !) means adding 4 to its base address.

Answer 5:-
C

Answer 6:-
C

Answer 7:-
B
“The printf function returns the number of characters successfully printed on the screen.”

Answer 8:-
C

2 thoughts on “C Lang. Skill Test 1 :

Leave a comment