MCQs based on Variable in C language
VARIABLES IN C
Points about variable in C:-
1.Variable is an entity that may change.
2.Variable is used to hold results and reserve memory for the data.
datatype variable_name;
3.The naming of variables is done by following the same rules of identifier naming.
Rules for naming a variable:
1. An variable name is any combination of 1 to 31 alphabets, digits, or underscores.
2. The first character in the variable name must be an alphabet or underscore.
3. No blanks or special symbols other than an underscore can be used in a variable name.
4. Keywords are not allowed to be used as variables.
Let us build some variables:
1.For speed of car we need to know
2.Distance traveled
3.Time taken to travel the distance
Variables to be declared as
Speed, s1, speed_of_car
Distance, d1, dist
Time, t1, time_of_travel
Basic C and variable declaration MCQ
1.which of the following characterize the typical feature of c language?.
A.high level B.machine independent
C.structured D.all of the above
2.C99 standard guarantees the uniqueness of ____ characters for internal names.
A. 31 B. 63
C. 12 D. 14
3.C99 standard guarantees the uniqueness of _____ characters for external names.
A. 31 B. 6
C. 12 D. 14
4. Which of the following is not a valid variable name declaration?
A. int _a6; B. int a_35;
C. int 9_a; D. int _3a
5. All keywords in C are in?
A. Lower Case letters B. Upper Case letters
C. Camel Case letters D. all
correct answer: A
6. How many keywords are there in c?
A. 31 B. 32
C. 64 D. 63
correct Ans: B
7. Which of the following is true for variable names in C?
A. Variable names cannot start with a digit
B. Variable can be of any length
C. They can contain alphanumeric characters as well as special characters
D. Reserved Word can be used as a variable name
correct Answer: A
8. Which of the following cannot be a variable name in C?
A. TRUE B. friend
C. export D. volatile
correct Answer : D
9. What is the output of this program?
#include <stdio.h>
int var = 2;
int main()
{
int var = var;
printf("%d ", var);
return 0;
}
A. Garbage Value B. 20
C. Compiler Error D. None of these
Correct Answer: A
10. Which of the following is not a valid C variable name?
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
correct Answer: d
Lots of effort and hardwork shown by this workπ₯π₯π...keep it up❤️
ReplyDeletemeans alotπ
DeleteGreat π
ReplyDeletethanx bro
DeleteAre kya baat kya baat
ReplyDeleteππ❤
DeleteGreat going and very good content .... need of an persuing engineer π
ReplyDeletethanks sir means a lot❤❤
DeleteYou have worked incredibly hard good luck are we are proud of you ππ€π
ReplyDeletethank you ππ
DeleteGreat work
ReplyDeleteKeep it up the good work.
thank you for your wishes❤
Delete