0% found this document useful (0 votes)
5 views

Global Soft Computer Technology

The document contains a series of multiple-choice questions (MCQs) focused on C programming concepts, including data types, operators, function declarations, and variable naming conventions. Each question provides four answer options, testing knowledge on syntax, output predictions, and programming principles. The content is designed for individuals preparing for assessments or enhancing their understanding of C programming.

Uploaded by

Akhilesh Pansare
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)
5 views

Global Soft Computer Technology

The document contains a series of multiple-choice questions (MCQs) focused on C programming concepts, including data types, operators, function declarations, and variable naming conventions. Each question provides four answer options, testing knowledge on syntax, output predictions, and programming principles. The content is designed for individuals preparing for assessments or enhancing their understanding of C programming.

Uploaded by

Akhilesh Pansare
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/ 9

Global Soft Computer Technology

------------------------------------------------------------------------------------------------------------------
-

C Programming MCQ (Multiple Choice Questions)

1.How many bytes does "int = D" use?


A. 1
B. 0
C. 10
D. 2 or 4

2. Directives are translated by the__________


A. Pre-processor
B. Compiler
C. Linker
D. Editor

3.If addition had higher precedence than multiplication,


then the value of the
expression (1 + 2 * 3 + 4 * 5) would be which of the following?
A. 27
B. 105
C. 69
D. 47
4. 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

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


a. =
b. ||
c. ==
d. !=

6.What will be the output of the following C code?

#include<stdio.h>
int main()
{
int p = 1, q = 2, r = 3, s = 4, x;
e = r + s = q * p;
printf(“%d, %d\n”, x, s);
}
a. Syntax error
b. 5, 2
c. 7, 2
d. 7, 4

7.The global variables are ____________.

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

8. 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
9. The #include <stdio.h> is a ______________.

a. Inclusion directive

b. File inclusion directive


c. Preprocessor directive
d. None of the above

10. Which of these properties of #define is false?

a. These always obey the scope rules


b. We can make use of a pointer to #define
c. The #define can be externally available
d. All of the above

11. 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

12. Out of the following function definition, which one will


run correctly?

a.
int sum(int x, int y)

return (x + y);

b.

int sum(int x, int y)

{return (x + y);}

c.

int sum(x, y)

return (x + y);

d. none of the above

13.Which of the following is not a valid C variable name?


a) int number;
b) float rate;
c) int variable_count;
d) int $main;

14. All keywords in C are in ____________


a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned
15. Which of the following is true for variable names in C?
a) They can contain alphanumeric characters as well as special
characters
b) It is not an error to declare a variable to be one of the
keywords(like goto, static)
c) Variable names cannot start with a digit
d) Variable can be of any length

16. Which is valid C expression?


a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;

17. What is an example of iteration in C?


a) for
b) while
c) do-while
d) all of the mentioned

18. The C-preprocessors are specified with _________


symbol.
a) #
b) $
c) ” ”
d) &
19.scanf() is a predefined function in______header file.
a) stdlib. h
b) ctype. h
c) stdio. h
d) stdarg. h
20.What will be the output of the following C code?

1. #include <stdio.h>
2. int main()
3. {
4. int y = 10000;
5. int y = 34;
6. printf("Hello World! %d\n", y);
7. return 0;
8. }
a) Compile time error
b) Hello World! 34
c) Hello World! 1000
d) Hello World! followed by a junk value

21.What will be the final value of x in the following C code?

1. #include <stdio.h>
2. void main()
3. {
4. int x = 5 * 9 / 3 + 9;
5. }
a) 3.75
b) Depends on compiler
c) 24
d) 3

22.What will be the output of the following C function?

1. #include <stdio.h>
2. void reverse(int i);
3. int main()
4. {
5. reverse(1);
6. }
7. void reverse(int i)
8. {
9. if (i > 5)
10. return ;
11. printf("%d ", i);
12. return reverse((i++, i));
13. }

a) 1 2 3 4 5
b) Segmentation fault
c) Compilation error
d) Undefined behaviour

You might also like