QUIZ ON : C LANGUAGE - INTRODUCTION TO C LANGUAGE

INTRODUCTION TO C LANGUAGE

00:00:00

Which of the following is a valid string constant?

Option A. “programming Trick”
Option B. “programming
Option C. ‘programming
Option D. $ programming $
True Answer A

Explanation :

Which of the following is a valid string constant?

Question No# : 01 out of 20



in C language the output of 14 % 4 is

Option A. 1
Option B. 2
Option C. 3
Option D. 4
True Answer B

Explanation :

in C language the output of 14 % 4 is

Question No# : 02 out of 20



Calling a uninitialized variable will provide zero value.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

Calling a uninitialized variable will provide zero value.

Question No# : 03 out of 20

Which of the following is not logical operator?

Option A. &
Option B. &&
Option C. ||
Option D. !
True Answer A

Explanation :
Bitwise operators: & is a Bitwise AND operator. Logical operators: && is a Logical AND operator. || is a Logical OR operator. ! is a NOT operator.

Which of the following is not logical operator?

Question No# : 04 out of 20



Two different operators would always have different associativity.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :
No, Two different operators may have same associativity.

Two different operators would always have different associativity.

Question No# : 05 out of 20

All of the following are valid expressions in ‘C’.

a = 2 + (b = 5);
a = b = c = 5;
a = 11 % 3

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

All of the following are valid expressions in ‘C’.

a = 2 + (b = 5);
a = b = c = 5;
a = 11 % 3

Question No# : 06 out of 20



The precedence of arithmetic operators is (from highest to lowest) %, *, /, +, –

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

The precedence of arithmetic operators is (from highest to lowest) %, *, /, +, –

Question No# : 07 out of 20

Size of short integer and long integer can be verified using the sizeof() operator

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Size of short integer and long integer can be verified using the sizeof() operator

Question No# : 08 out of 20

Find the output of following code :

int main() 
{
int i=-2;
printf (“-i=%d”,-i);
return b;
}

Option A. –i=2
Option B. i=-2
Option C. –i=-2
Option D. –i=+2
True Answer D

Explanation :

Find the output of following code :

int main() 
{
int i=-2;
printf (“-i=%d”,-i);
return b;
}

Question No# : 09 out of 20



Which data type is most suitable for storing a number 65000 in a 32-bit system?

Option A. signed short
Option B. unsigned short
Option C. long
Option D. int
True Answer B

Explanation :
65000 comes in the range of short (16-bit) which occupies the least memory. Signed short ranges from -32768 to 32767 and hence we should use unsigned short.

Which data type is most suitable for storing a number 65000 in a 32-bit system?

Question No# : 10 out of 20



Right shift of an unsigned integer by one bit is equivalent to multiplying it by two.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Right shift of an unsigned integer by one bit is equivalent to multiplying it by two.

Question No# : 11 out of 20

sizeof( ) is a function that returns the size of a variable.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

sizeof( ) is a function that returns the size of a variable.

Question No# : 12 out of 20

The statement void p; is valid.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

The statement void p; is valid.

Question No# : 13 out of 20

Which one is incorrect statement for C Language?

Option A. C compiler supports octal integer constant.
Option B. C compiler supports hexadecimal integer constant.
Option C. C compiler supports binary integer constant.
Option D. C compiler supports decimal integer constant.
True Answer D

Explanation :

Which one is incorrect statement for C Language?

Question No# : 14 out of 20



When the following piece of code is executed, what happens?

b = 3;
a = b++;

Option A. a contains 3 and b contains 4
Option B. a contains 4 and b contains 4
Option C. a contains 4 and b contains 3
Option D. a contains 3 and b contains 3
True Answer A

Explanation :

When the following piece of code is executed, what happens?

b = 3;
a = b++;

Question No# : 15 out of 20



Which is invalid name of identifier?

Option A. world
Option B. addition23
Option C. test-name
Option D. factorial
True Answer C

Explanation :

Which is invalid name of identifier?

Question No# : 16 out of 20



The && and | | operators

Option A. compare two numeric values
Option B. combine two numeric values
Option C. compare two boolean values
Option D. None of the above
True Answer C

Explanation :

The && and | | operators

Question No# : 17 out of 20



Which is valid C expression?

Option A. int my_num = 100,000;
Option B. int my_num = 100000;
Option C. int my num = 1000;
Option D. int $my_num = 10000;
True Answer B

Explanation :
Space, comma and $ cannot be used in a variable name.

Which is valid C expression?

Question No# : 18 out of 20



For 16 bit compiler allowable range for integer constants is

Option A. -3.4e38 to 3.4e38
Option B. -32767 to 32768
Option C. -32668 to 32667
Option D. -32768 to 32767
True Answer D

Explanation :

In a 16 Bit C compiler we have 2 bytes to store an integer, and 1 byte for a character. For unsigned integers the range is 0 to 65535. For signed integers the range is -32768 to 32767.

For 16 bit compiler allowable range for integer constants is

Question No# : 19 out of 20



In the passage of text, individual words and punctuation marks are known as

Option A. Constants
Option B. Keywords
Option C. Operators
Option D. Tokens
True Answer D

Explanation :

In the passage of text, individual words and punctuation marks are known as

Question No# : 20 out of 20