1. Which of the following special symbol allowed in a variable name?
A. * (asterisk)
B. | (pipeline)
C. - (hyphen)
D. _ (underscore)
Answer: Option D
2. How would you round off a value from 1.66 to 2.0?
A. ceil(1.66)
B. floor(1.66)
C. roundup(1.66)
D. roundto(1.66)
Answer: Option A
3. Is the following statement a declaration or definition?
extern int i;
A. Declaration
B. Definition
C. Function
D. Error
Answer: Option A
4. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
A. .
B. &
C. *
D. ->
Answer: Option D
5. The operator used to get value at address stored in a pointer variable is
A. *
B. &
C. &&
D. ||
Answer: Option A
6. If the two strings are identical, then strcmp() function returns
A. -1
B. 1
C. 0
D. Yes
Answer: Option C
Explanation:
Declaration: strcmp(const char *s1, const char*s2);
The strcmp return an int value that is
if s1 < s2 returns a value < 0
if s1 == s2 returns 0
if s1 > s2 returns a value > 0
7. Which of the following function is more appropriate for reading in a multi-word string?
A. printf();
B. scanf();
C. gets();
D. puts();
Answer: Option C
Explanation:
gets(); collects a string of characters terminated by a new line from the standard input stream stdin
8. Which header file should be included to use functions like malloc() and calloc()?
A. memory.h
B. stdlib.h
C. string.h
D. dos.h
Answer: Option B
9. Input/output function prototypes and macros are defined in which header file?
A. conio.h
B. stdlib.h
C. stdio.h
D. dos.h
Answer: Option C
10. In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array
Answer: Option C
11. What is the purpose of fflush() function.
A. flushes all streams and specified streams.
B. flushes only specified stream.
C. flushes input/output buffer.
D. flushes file buffer.
Answer: Option A
Explanation:
"fflush()" flush any buffered output associated with filename, which is either a file opened for writing or a shell command for redirecting output to a pipe or coprocess.
Example:
fflush(FilePointer);
fflush(NULL); flushes all streams.
12. Which of the following correctly shows the hierarchy of arithmetic operations in C?
A. / + * -
B. * - / +
C. + - / *
D. / * + -
Answer: Option D
Explanation:
Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction).
How Do I Remember ? BODMAS !
B - Brackets first
O - Orders (ie Powers and Square Roots, etc.)
DM - Division and Multiplication (left-to-right)
AS - Addition and Subtraction (left-to-right)
13. How will you free the allocated memory ?
A. remove(var-name);
B. free(var-name);
C. delete(var-name);
D. dalloc(var-name);
Answer: Option B
14. What are the different types of real data type in C ?
A. float, double
B. short int, double, long int
C. float, double, long double
D. double, long int, float
Answer: Option C
Explanation:
The floating point data types are called real data types. Hence float, double, and long double are real data types.
15. Which of the following cannot be checked in a switch-case statement?
A. Character
B. Integer
C. Float
D. enum
Answer: Option C
Explanation:
The value of the 'expression' in a switch-case statement must be an integer, char, short, long. Float and double are not allowed.
A. * (asterisk)
B. | (pipeline)
C. - (hyphen)
D. _ (underscore)
Answer: Option D
2. How would you round off a value from 1.66 to 2.0?
A. ceil(1.66)
B. floor(1.66)
C. roundup(1.66)
D. roundto(1.66)
Answer: Option A
3. Is the following statement a declaration or definition?
extern int i;
A. Declaration
B. Definition
C. Function
D. Error
Answer: Option A
4. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
A. .
B. &
C. *
D. ->
Answer: Option D
5. The operator used to get value at address stored in a pointer variable is
A. *
B. &
C. &&
D. ||
Answer: Option A
6. If the two strings are identical, then strcmp() function returns
A. -1
B. 1
C. 0
D. Yes
Answer: Option C
Explanation:
Declaration: strcmp(const char *s1, const char*s2);
The strcmp return an int value that is
if s1 < s2 returns a value < 0
if s1 == s2 returns 0
if s1 > s2 returns a value > 0
7. Which of the following function is more appropriate for reading in a multi-word string?
A. printf();
B. scanf();
C. gets();
D. puts();
Answer: Option C
Explanation:
gets(); collects a string of characters terminated by a new line from the standard input stream stdin
8. Which header file should be included to use functions like malloc() and calloc()?
A. memory.h
B. stdlib.h
C. string.h
D. dos.h
Answer: Option B
9. Input/output function prototypes and macros are defined in which header file?
A. conio.h
B. stdlib.h
C. stdio.h
D. dos.h
Answer: Option C
10. In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array
Answer: Option C
11. What is the purpose of fflush() function.
A. flushes all streams and specified streams.
B. flushes only specified stream.
C. flushes input/output buffer.
D. flushes file buffer.
Answer: Option A
Explanation:
"fflush()" flush any buffered output associated with filename, which is either a file opened for writing or a shell command for redirecting output to a pipe or coprocess.
Example:
fflush(FilePointer);
fflush(NULL); flushes all streams.
12. Which of the following correctly shows the hierarchy of arithmetic operations in C?
A. / + * -
B. * - / +
C. + - / *
D. / * + -
Answer: Option D
Explanation:
Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction).
How Do I Remember ? BODMAS !
B - Brackets first
O - Orders (ie Powers and Square Roots, etc.)
DM - Division and Multiplication (left-to-right)
AS - Addition and Subtraction (left-to-right)
13. How will you free the allocated memory ?
A. remove(var-name);
B. free(var-name);
C. delete(var-name);
D. dalloc(var-name);
Answer: Option B
14. What are the different types of real data type in C ?
A. float, double
B. short int, double, long int
C. float, double, long double
D. double, long int, float
Answer: Option C
Explanation:
The floating point data types are called real data types. Hence float, double, and long double are real data types.
15. Which of the following cannot be checked in a switch-case statement?
A. Character
B. Integer
C. Float
D. enum
Answer: Option C
Explanation:
The value of the 'expression' in a switch-case statement must be an integer, char, short, long. Float and double are not allowed.
Congratulations to Epic Warriors, Awesome Blossom & Yogesh is individual winner |
Comments
Post a Comment