0% found this document useful (0 votes)
20 views6 pages

Untitled Quiz - Answers

Uploaded by

meromero120201
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)
20 views6 pages

Untitled Quiz - Answers

Uploaded by

meromero120201
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/ 6

Untitled Quiz

Answers

1. What does the function header 'void main (void)'


indicate?

A. The function will return an integer value.

B. The function will take an integer as input.

C. The function will not return any value.

D. The function will take no input parameters.

Answer: The function will not return any value. (C)

The function header indicates the return type and parameters of the
function.

2. What is the purpose of the function prototype in C?

A. To declare the function return type

B. To define the function body

C. To provide a blueprint for the function

D. To call the function

Answer: To provide a blueprint for the function (C)


The function prototype is used to check if the function is called
correctly.
3. What is the data type of the variable that occupies 1
byte of memory in C?

A. int

B. char

C. float

D. long

Answer: char (B)

The char data type in C occupies 1 byte of memory.

4. What is the purpose of the '#include' directive in C?

A. To include a header file

B. To define a function

C. To declare a variable

D. To call a function

Answer: To include a header file (A)

The '#include' directive is used to include header files in a C program.

5. What is the purpose of the 'clrscr()' function in C?

A. To print a message

B. To clear the screen

C. To exit the program

D. To take input from the user

Answer: To clear the screen (B)


The 'clrscr()' function is used to clear the screen.
6. What is the size of the 'long' data type in C?

A. 8 bytes

B. 4 bytes

C. 2 bytes

D. 1 byte

Answer: 4 bytes (B)


The 'long' data type in C occupies 4 bytes of memory.

7. What is the purpose of an operator in C?

A. To print a message

B. To perform a mathematical operation

C. To declare a variable

D. To call a function

Answer: To perform a mathematical operation (B)

An operator is a symbol that tells the compiler to perform a specific


mathematical or logical operation.

8. What is the function of the unary operator ~?

A. To decrease the value of the operand by 1 unit

B. To increase the value of the operand by 1 unit

C. To convert the operand to its one's complement

D. To convert the operand to its two's complement

Answer: To convert the operand to its one's complement (C)


The unary operator ~ is used to convert the operand to its one's
complement, which means it flips all the bits, i.e., 0's become 1's and
1's become 0's.
9. What is the result of the expression int x=5; int y; y =
x++?

A. y = 5, x = 6

B. y = 5, x = 5

C. y = 6, x = 6

D. y = 6, x = 5

Answer: y = 5, x = 6 (A)
The postfix increment operator ++ first assigns the value of the
operand to the variable y, then increments the value of the operand x.

10. What is the purpose of the casting operator ()?

A. To increase the value of the operand by 1 unit

B. To change the value of the operand to its two's complement

C. To change the value of the operand to its one's complement

D. To change the data type of the operand

Answer: To change the data type of the operand (D)


The casting operator () is used to change the data type of the
operand, which means it can be used to convert an operand from one
data type to another.
11. What is the result of the expression int x=3, y=5; float
f; f = y / x;

A. 3.0

B. 5.0

C. 1.0

D. 1.66666

Answer: 1.0 (C)


The division operation is performed as integer division because both
operands are integers, which means the result is an integer, and the
decimal part is truncated.

12. What is the function of the Binary AND Operator


&?

A. It copies a bit if it exists in one operand but not both

B. It copies a bit if it does not exist in either operand

C. It copies a bit if it exists in both operands

D. It copies a bit if it exists in either operand

Answer: It copies a bit if it exists in both operands (C)


The Binary AND Operator & copies a bit to the result if it exists in
both operands.
13. What is the function of the sizeof() operator?

A. It returns the value of a variable

B. It returns the size of a variable

C. It returns the address of a variable

D. It returns the data type of a variable

Answer: It returns the size of a variable (B)


The sizeof() operator returns the size of a variable, which is the
number of bytes it occupies in memory.

14. What is the function of the Short-Circuit AND Operator


&&?

A. It evaluates the left operand and returns false if it is false, without


evaluating the right operand

B. It evaluates the right operand and returns false if it is false, without


evaluating the left operand
C. It evaluates both operands and returns true if both are true

D. It evaluates both operands and returns true if either is true

Answer: It evaluates the left operand and returns false if it is false,


without evaluating the right operand (A)
The Short-Circuit AND Operator && evaluates the left
operand and returns false if it is false, without evaluating the right
operand.

You might also like