0% found this document useful (0 votes)
48 views10 pages

C Questions and Answers

The document contains questions about C programming language concepts like data types, operators, functions, arrays, structures, pointers etc. It tests the understanding of basic as well as advanced C programming concepts through multiple choice questions. C is a general purpose programming language that is both high-level and low-level. It has keywords and is commonly used on operating systems like Unix, Linux and Windows. Functions, arrays, structures and pointers are important data structures in C.

Uploaded by

Shubham Bothra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views10 pages

C Questions and Answers

The document contains questions about C programming language concepts like data types, operators, functions, arrays, structures, pointers etc. It tests the understanding of basic as well as advanced C programming concepts through multiple choice questions. C is a general purpose programming language that is both high-level and low-level. It has keywords and is commonly used on operating systems like Unix, Linux and Windows. Functions, arrays, structures and pointers are important data structures in C.

Uploaded by

Shubham Bothra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1.

C us supported by the following operating system:


A. Unix
B. Linux
C. Windows
D. All of above
2. C is the ____________ language:
A. Low level
B. High Level
C. Both Low and High Level
D. None of these
3. C has ____________ keywords:
A. 30
B. 31
C. 32
D. 33
4. Which is not the fundamental data types?
A. Char
B. Array
C. Int
D. Float
5. Variable is a:
A. Location in memory
B. Location in CPU Registers
C. Both
D. None of these
6. int can store _______________
A. Real numbers
B. Characters
C. String
D. None of these
7. The Arithmetic operator '%' can be used with:
A. int
B. float
C. double
D. void
8. Which is the symbol for AND operator:
A. ||
B. &&
C. $$
D. None of these
9. C program starts executing from:
A. main()
B. header file
C. both
D. None of these
10. Which is the incorrect statement:
A. Variable name can contain underscore.
B. Variable name may start from digit.
C. Variable name may not have white space character.
D. Keyword cannot be a variable name.
11. String is:
A. Array of numbers.
B. Array of characters.
C. Both
D. None of these.
12. Which statement is wrong:
A. A function may have arguments.
B. A function may return value.
C. A can be invoked many times in a single program.
D. Function cannot be reused

13. A function can return only ____________


A. Single value
B. Two Values.
C. Many values.
D. None of these
14. Mathematical function are stored in ____________ header file:
A. stdio.h
B. conio.h
C. math.h
D. string.h
15. An array can be declared:
A. Statically
B. Dynamically
C. Both
D. None of these
16. An array is ____________ data-structure:
A. Linear
B. Non-linear
C. Hierarchical
D. None of these
17. Which term is not related to function:
A. Prototype
B. Definition
C. Call
D. Recipient
18. A pointer variable can store ____________.
A. Constant value
B. Value of anther variable.
C. Address of another variable
D. None of these.

19. Which is the incorrect function prototype:


A. int add(int,int);
B. int add(float, int);
C. float add(int,int);
D. float add(float,int);
20. Which is the type of files:
A. Text
B. Binary
C. Both
D. None of these
21. Which function is not related to file handling:
A. fopen();
B. fclose();
C. fprintf();
D. printf()
22. A structured programming have:
A. Sequence
B. Selection
C. Iteration
D. All of Above
23. Which is not the selective control flow statement:
A. while
B. if
C. Switch-case
D. if-else
24. Who is the manufacturer of C language:
A. Herbert Schieldt
B. Banjarne Stroups
C. Dennis Ritchie
D. None of these
25. __________ is used to break out of a program?

a) break
b) continue
c) terminate
d) exit
Q26. Functions with the same name and different parameters represents :
a) function overloading
b) function overriding
c) recursion
d) None of the mentioned
Q27 Can we declare a function inside the structure of C?
a) YES
b) NO
c) Both of them
d) None of them
28.What will happen if in a C program you assign a value to an array element whose
subscript exceeds the size of array?
A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The array size would appropriately grow.
29. long int factorial (long x)
{
????
return x * factorial(x – 1);
}
With what do you replace the ???? to make the function shown above return the correct
answer?
A. if (x == 0) return 0;
B. return 1;
C. if (x >= 2) return 2;
D. if (x <= 1) return 1;

30. C programs are converted into machine language with the help of
A. An Editor
B. A compiler
C. An operating system
D. None of the above
31. In switch statement, each case instance value must be _______?
A. Constant
B. Variable
C. Special Symbol
D. None of the avobe

32) Choose a correct statement about C structures.


A) Structure elements can be initialized at the time of declaration.
B) Structure members cannot be initialized at the time of declaration
C) Only integer members of structure can be initialized at the time of declaraion
D) None of the above

33) Choose a correct statement about C structure.?


int main()
{
struct ship
{

};
return 0;
}

A) It is wrong to define an empty structure


B) Member variables can be added to a structure even after its first definition.
C) There is no use of defining an empty structure
D) None of the above

34. What is the output of C program with structures.?


int main()
{
struct tree
{
int h;
int w;
};
struct tree tree1={10};
printf("%d ",tree1.w);
printf("%d",tree1.h);
return 0;
}
Output:
A) 0 0
B) 10 0
C) 0 10
D) 10 10

35. What is the output of C program.?


int main()
{
struct laptop
{
int cost;
char brand[10];
};
struct laptop L1={5000,"ACER"};
struct laptop L2={6000,"IBM"};
printf("Name=%s",L1.brand);
return 0;
}
Output:
A) ACER
B) IBM
C) Compiler error
D) None of the above

36. What is the output of C program with structure arrays.?


int main ()
{
struct pens
{
int color;
}p1[2];
struct pens p2[3];
p1[0].color=5;
p1[1].color=9;
printf("%d ",p1[0].color);
printf("%d",p1[1].color);
return 0;
}
Output:
A) 5 5
B) 5 9
C) 9 5
D) Compiler error

34. Determine the output of the C code mentioned below:


#include <stdio.h>
int main()
{
float q = ‘a’;
printf(“%f”, q);
return 0;
}

a. run time error


b. a
c. 97.000000
d. a.0000000

35. Which of these is NOT a relational or logical operator?


a. =
b. ||
c. ==
d. !=
36. Out of the following, which one is not valid as an if-else statement?
a. if ((char) x){}
b. if (x){}
c. if (func1 (x)){}
d. if (if (x == 1)){}

37. We cannot use the keyword ‘break’ simply within _________.


a. while
b. for
c. if-else
d. do-while

38. The output of the C code mentioned below would be:


#include <stdio.h>
int main()
{
int a = 0, b = 0;
while (a < 2)
{
a++;
while (b < 3)
{
printf(“find\n”);
goto l1;
}
}
}
a. loop loop find loop
b. Infinite error
c. find loop
d. Compile time loop

39. The global variables are ____________.


a. External
b. Internal
c. Both External and Internal
d. None of the above

40. Out of the following operations, which one is not possible in the case of a register
variable?
a. Global declaration of the register variable
b. Copying the value from the memory variable
c. Reading any value into the register variable
d. All of the above

41. The correct format of declaring a function is:


a. type_of_return name_of_function (argument type);
b. type_of_return name_of_function (argument type){}
c. type_of_return (argument type) name_of_function;
d. all of the above

You might also like