C Programming MCQ (Mulitple Choice Questions and Answers)
-
Who is invented c language?
Charles babbage
Dennis Ritchie
James gosling
Guido van
-
Which language is being replaced by C Language?
Fortran
D language
Python
B language
-
C is Which type of programming language.?
Structure
Functional
Positional
Procedural
-
In which laboratories was C language invented?
AT&T Bell Labs
Uniliver Labs
IBM Labs
Verizon Labs
-
What is the name of the BCPL language?
C Language
D Language
B Language
None
-
What Operating System was developed using the C language?
Android
Unix
Operating
Microsoft
-
In which year C programming is developed?
1968
1970
1972
1984
-
Which one is used to tell the preprocessor to insert the contents of another file into the Source Code?
#include
stdio
void main()
clrscr()
-
In C, the program execution starts from?
printf()
scanf()
main()
getch()
-
Which function is used to print the formatted string in output Screen.
printf()
scanf()
main()
getch()
-
Which function is accepting input from the user?
printf()
scanf()
main()
getch()
-
Which level is C language belonging to?
Middle level
Low level
High level
Machine level
-
Which of the following symbol is used to denote a preprocessor statement
#
;
()
{}
-
What symbol is used to End of the statement?
#
;
()
{}
-
Which character is used to the new line in c?
\a
\b
\n
\L
-
What constants need to be enclosed between single quotes?
string
float
Integer
character
-
What constants need to be enclosed between Double quotes?
string
float
Integer
character
-
What is the limit of short int in C?
-32762 to 32761
-32743 to 32742
-32796 to 32795
-32768 to 32767
-
Which of the following is not a valid C variable name?
int a;
float b;
int -c;
float _d;
-
Identify a character constant.
'A'
"B"
"\n"
None of the Above
-
Which of the following is an arithmetic operator?
+
<=
>=
!=
-
Relational operator have highest precedence than bitwise operator
TRUE
FALSE
-
Which of these operators has the lowest precedence?
++
--
<-
!=
-
sizeof() is a _______ type of operator
secondary
binary
unary
ternary
-
Relational operator will always return value in form of ________
1 or 2
0 or 1
True
FALSE
-
Which operator is not right to left associative ?
&
++
>
<
-
The post increment operator will change the value after variable has been used
TRUE
FALSE
-
Which operator is used for modulus division in c ?
/
*
%
+
-
Which operator is used for equality comparision of c ?
=
==
!=
None
-
Which among the following highest precedence ?
sizeof()
&
<<
!
-
Which data type can accept switch statement
int
char
shot
All of the above
-
Can we use logical operators in switch statement?
Yes
No
-
How many arguments are passed to the switch statement ?
1
2
Infinity
All of the above
-
The character value is used in the switch in C?
True
False
-
A switch block can be labeled with one or more cases.
False
True
-
Which identifier is used to define a label in goto statement
;
:
,
=
-
Can we use goto in while loop in C?
Yes
No
-
Can we use goto statement to create loops?
No
Yes
-
Which of the following statement about for GOTO is true?
goto statement is a jump statement.
goto statement is used for altering the normal sequence.
The goto statement transfers control to a label.
All of the above
-
what will be the output of the following code?
#include <stdio.h> void main() { printf("W"); goto A; printf("o"); goto B; printf("r"); A: printf("l"); B: printf("d"); }
wold
wrld
wld
wrd
-
Choose a C Conditional Operator
?:
:?
:<
<:
-
Which of the following control structure is implemented using if statement ?
Sequential
Function Call
Repetition
Selection
-
All keywords in C are in ____________
Upper Case
Camel Case
Lower Case
All of these
-
In C, all keywords are case sensitive
True
False
-
A condition in an IF statement is always written in ____.
[]
{}
<>
()
-
We can write an if statement without brackets?
FALSE
TRUE
-
The conditional operator are also known as
Ternary operator
Relational operator
Increment operator
Logical operator
-
Which operator is used to check multiple conditions are true in C?
NOT
OR
AND
NONE
-
what will be the output of the following code?
void main() { if(printf("Hello")){ printf(" World"); }else{ printf(" Welcome"); } }
- Hello
- Hello World
- Hello Welcome
- Welcome
-
what will be the output of the following code?
#include<stdio.h> void main() { char ch='A'; if(ch == 65){ printf(" Hi"); }else{ printf(" Hello"); } }
- Hi Hello
- Hello
- Error
- Hi
-
How many times does the loop run in the following code?
for(i=0;i<5;i+=2)
4
3
2
5
-
The continue statement cannot be used in ________ ?
do-while
for
while
switch
-
What is the way to quit loop in c language ?
if
break
switch
do
-
Which loop is most suitable to first perform the operation and then test the condition?
for loop
do-while loop
while loop
None of these
-
Which loop are executed at least once, even if the test condition is false
do-while
while
for
if
-
What are the Loops are used in C language ?
for
while
do-while
All the above
-
Infinite loop can be created using ?
do{}while
while()
for(;;)
All the these
-
Goto statement is also known as unconditional ?
TRUE
FALSE
-
Which keyword can be used for coming out of recursion?
Break
Check
Return
Both A and B
-
what will be the output of following C code ?
#include <stdio.h> void main() { int i = 15; do { printf("Hello world"); } while (i != 15); }
Nothing
Infinite times
Hello World
Run time error
-
What is the highest index for an array with 10 elements ?
6
7
8
9
-
An array is defined as finite ordered collection of ______ data.
Stored
Inbuild
Homogenous
Collection
-
What is the term for accessing elements of an array using an index ?
Indexing
Pointer
Enemeration
Collection
-
How many types of array in c program ?
Five
Two
Four
Three
-
Which dimensional array is represents a linear collection of data ?
Single
Multi
Two
Nothing
-
Two dimensional array represent a ________.
Square
Column
Row
Matrix
-
An array can be declared of any _________ data type.
Standard
Custom
Both A and B
None
-
The declaration int arr[4][5]; will allocate _____ bytes.
40
50
80
20
-
Index of an array starts from
1
0
-1
2
-
What are the elements present in the array of the following code?
int arr[3] = {3};
0,0,0
3,0,0
3,3,3
0,0,3
-
Which of the following function is more appropriate for reading in a multi-word string?
gets()
scanf()
printf()
main()
-
Length of the string "Hello World" is
12
11
15
8
-
Strcat function adds null character
Only if there is space
Depends on the standard
Depends on the compiler
Always
-
Which keyword is used to declare a character array in c ?
str
string
char
int
-
which function is used to compare two strings ?
strcat
strfind
strcmp
strchk
-
which function is used to find length of a string ?
strlen
strsize
strlength
lenstr
-
A character constant is enclosed by ?
Double quotes
Single quotes
Square brackets
None of the above
-
What will be the value of var for the following code?
int c = strcmp("Hello", "hello");
-1
1
0
2
-
Terminate a string with
Space
Null
Semicolon
Colon
-
Which funtion used to compare strings without case-insensitive?
strcasecmp()
strcmp()
strtof()
strtod()
-
Which keyword is used to return value from function?
return
int
float
All of these
-
Which data structure is used to handle recursion in C?
Tree
Queue
Stack
None of the above
-
A function that calls itself is called a
Member Function
Recursive Function
Static Function
Primary Function
-
what is the purpose of the 'return' statement in a function?
Terminate a Program
Define a Function
Declare a Function
Return a value from Function
-
Which of the following string functions has return integer value?
strlen()
strlwr()
strcat()
strrev()
-
How many values can be returned by a C function?
2
1
Infinity
All of these
-
Find out the Non library function below in C ?
sqrt()
random()
printf()
gets()
-
How do you declare a pointer variable that can store the address of an int?
int &p;
int *p;
int p;
int p*;
-
Pointers can be used to
call by name
call by function
call by reference
call by itself
-
What will be the output of the following C code?
int a = 20; int *p = &a;
*p = 10; printf("%d",a);20
10
Throw an error
Address of 'a'
-
How do you declare an array of pointers to int?
int *p;
int* p[];
int &p[];
int p*[];
-
A structure is
Derived data type
User defined datatype
Secondary data type
All of the above
-
Which keyword is used to define a structure?
structure
struct
stru
All of the above
-
Which operator is used to access members of a structure.
And Operator (&)
Dot Operator (.)
Asterisk Operator (*)
Left Shift Operator (<)
-
Which of the following function is used to open a file in C?
fclose()
fseek()
fprint()
fopen()
-
Which function is used to close an opened file in C?
close_file()
file_close()
fclose()
fileclose()
-
What is the value of EOF in C?
Null
0
-1
1
-
Which function is used to delete a file in C?
unlink()
destroy()
delete()
remove()
-
The members of the union can be accessed using the arrow operator (->)
True
False
-
Size of union is size of the longest element in the union
True
False