Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

HCL Infosystems

C - Language 2010 Final Test


Instructions
1. Do not write anything on the Question Paper.
2. No Negative marking.
3. In case of Multiple Choice questions the required instructions will be mentioned in the question itself, else the
questions should be treated as Single Choice questions.
4. Candidates found Copying, Cheating or using any unfair means will be strictly dealt with.

No. of Questions -25 Set A


Max. Marks - 50 Time Limit- 1 Hours

1. In real world give 4 examples where we are using the C- Programming [1]

2. What are three different name of # sign? [1]

3. What is the meaning of #include<stdio.h> ? Define each part of the statement. [1]

4. What is the use of sizeof() operator? Give an example. [1]

5. Print the following structure with the help of for loop [2]

****
***
**
*

6. Write a program in C for factorial of a given number. The number is input by the user and
containing the integer type value. [2]

7. Predict the output for the following: [1]


main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}
a. 1 1
b. 1 2
c. 2 2
d. 2 1

8. What is the difference between call by value and call by reference? [1]
9. What is the default value of register variable? [1]
a. garbage
b. 0
c. 0x0 (hexadecimal zero)
d. Not sure

10. Write a program in C to calculate all prime numbers between 1 and 50. [3]

11. What is the meaning of array in C? What are the types of array? Explain in brief and Give an
example of integer type of array. [3]

12. What will be the highest precedence operator among the following.. [1]
a. ~
b. &&
c. ( )
d. ++

13. Define function in C. Make a function AREA() to calculate the area of a circle. [2]

14. Evaluate the values of following [2]


a. 200<<3
b. 100<<4
c. 280>>3
d. !(120)

15. Give a flow chart for even and odd number program. [2]

16. What are the largest and smallest values that can be reliably stored in a variable [1]
of type int?
17. What is the difference between getch(), getche() and getchar() ? [3]

18. What will be the output of following program [2]


#include<stdio.h>
int main()
{
int a=12,b=17,c=10;
d=(a>b&&a>c)?a:((b>a&&b>c)?b:c)
printf("%d",d);
}
a. 0
b. 12
c. 17
d. 10
19. Give an example of pointer arithmetic’s. [2]

20. What is the storage class in C ? Define it with all its members. [2]

21. What do these loops print? [2]

for (i = 0; i < 10; i = i + 2)


printf("%d\n", i);
for(i = 100; i >= 0; i = i - 7)
printf("%d\n", i);
for(i = 1; i <= 10; i = i + 1)
printf("%d\n", i);
for(i = 2; i < 100; i = i * 2)
printf("%d\n", i);

22. Write a program to print the numbers from 1 to 10 and their squares: [2]
1 1
2 4
3 9
.. .
10 100

23. A- What is the difference between Structure and Union? Explain with example? [5]
B- What is the numeric value of the expression 3 < 4?

24. Under what conditions will this code print ``water''? [3]
if(T < 32)
printf("ice\n");
else if(T < 212)
printf("water\n");
else printf("steam\n");

25. A- Write a program to print all the ASCII values and their equivalent characters using a [4]
while loop. (The ASCII values vary from 0 to 255).
B- Difference between break and continue ?

You might also like