NEW
Font size
WorksheetsTechnical MCQ
Total questions: 45
Worksheet time: 23mins
The format identifier ‘%i’ is also used for which data type?
char
int
float
double
What is the size of an int data type?
4 Bytes
8 Bytes
Depends on the system/compiler
Cannot determine.
Which is correct with respect to the size of the data types?
char > int > float
int > char > float
char < int < double
double > char > int
What is the precedence of arithmetic operators (from highest to lowest)?
%, *, /, +, –
%, +, /, *, –
+, -, %, *, /
%, +, -, *, /
Which of the following is a correct format for declaration of function?
return-type (argument type)function-name;
return-type function-name(argument type);
return-type function-name(argument type) {}
No idea!
What is the default return type if it is not specified in function definition?
void
int
double
short int
What are the different ways to initialize an array with all elements as zero?
int array[5] = {};
int array[5] = {0};
int a=0, b=0, c=0; int array[5] = {a, b, c};
All of the mentioned.
How many times i value is checked in the following C code?
#include <stdio.h>
int main()
{ int i = 0;
do {
i++;
printf("in while loop\n");
} while (i < 3); }
2
3
4
1
Who is the father of C language?
Steve Jobs
James Gosling
Dennis Ritchie
Rasmus Lerdorf
Which of the following is not a valid C variable name?
int number;
float rate;
int variable_count;
int $main;
All keywords in C are in ____________
LowerCase letters
UpperCase letters
CamelCase letters
None of the mentioned
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;
int my_num = 100,000;
int my_num = 100000;
int my num = 1000;
int $my_num = 10000;
Which keyword is used to prevent any changes in the variable within a C program?
immutable
mutable
const
volatile
What is an example of iteration in C?
for
while
do-while
all of the mentioned
What is #include <stdio.h>?
Preprocessor directive
Inclusion directive
File inclusion directive
None of the above
The C-preprocessors are specified with _________ symbol.
#
$
%
None of the above.
The standard header _______ is used for variable list arguments (…) in C.
<stdio.h >
<stdlib.h>
<math.h>
<stdarg.h>
What is the sizeof(char) in a 32-bit C compiler?
1 bit
2 bits
1 Byte
2 Bytes
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
Compile time error
Hello World! 34
Hello World! 1000
Hello World! followed by a junk value
What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
3.75
Depends upon compiler
24
3
What are the elements present in the array of the following C code?
int array[5] = {5};
5, 5, 5, 5, 5
5, 0, 0, 0, 0
5, (garbage), (garbage), (garbage), (garbage)
(garbage), (garbage), (garbage), (garbage), 5
What are true about Array in C language.?
A group of elements of same data type.
An array contains more than one element
Array elements are stored in memory in continuous or contiguous locations
All the above.
An array Index starts with.?
-1
0
1
2
What is the output of the following code snippet?
int main()
{ int sum = 2 + 4 / 2 + 6 * 2;
printf("%d", sum);
return 0;
}
2
15
16
18
What is the output of the following code?
#include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
3
4
5
Compile time error
What is the output of this statement "printf("%d", (a++))"?
The value of (a + 1)
The current value of a
Error message
Garbage Value
What does this declaration mean?
int x: 4;
X is a four-digit integer.
X cannot be greater than a four-digit integer.
X is a four-bit integer.
None of the these
How many times will the following loop execute?
for(j = 1; j <= 10; j = j-1)
forever
never
0
1
Which one of the following is a loop construct that will always be executed once?
for
while
switch
do-while
How many characters can a string hold when declared as follows?
char name[20]:
19
20
Can't determine
18
What will the result of num1 variable after execution of the following statements?
int j = 1, num1 = 4;
while (++j <= 10)
{
num1++;
}
11
12
13
14
Let p1 be an integer pointer with a current value of 2000. What is the content of p1 after the expression p1++ has been evaluated?
2001
2002
2004
2008
What will be the output of this program?
int main()
{
int a=10, b=20;
printf("a=%d b=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("a=%d b=%d",a,b);
return 0;
}
a = 20, b = 20
a = 10, b = 20
a = 20, b = 10
a = 10, b = 10
What does this statement mean?
x - = y + 1;
x = x - y + 1
x = -x - y - 1
x = x + y - 1
x = x - y - 1
Array is a _________ data structure.
Non-linear
Primary
Linear
Non-primary
Study the following statement
printf ("%d", 9/5);
What will be the output of this statement?
1.8
1.2
1.5
None of the aove
A global variable is declared __________.
Outside of the function
Inside of the function
With the function
Anywhere in the program
Who defines the user-defined function?
Computer
compiler
Users
None
The enum keyword is used to assign names to the ________ constants.
Integer
String
Character
All of the above
Which of the following is not an arithmetic operation?
x * = 65;
x / = 42;
x % = 2;
x ! = 56;
Which of the following operator is represented a relational operation?
==
++
||
&&
Which of the following keyword is used for union in c language?
un
uni
ion
union
Study the following program:
main ()
{
char x;
x = 'A' + 5;
printf("%c", x);
}
A+5
A
F
E
Which one of the following operators is a unary operator in c language?
&
&&
<<
sizeof()
How many types of variables are there in the C language?
2
4
5
3
