C Language Fundamentals
All Questions for: C Language Fundamentals
Question 51: Which operator is used to compare two values for equality in C?
- A =
- B ==
- C <>
- D !=
Explanation: The operator used to compare two values for equality in C is . The double equal sign () is the equality operator, and it is used to check if two values are equal to each other. So, the correct answer is: Here's an example of using the equality operator in C: In this example, the program checks if 'x' is equal to 'y' using the operator and prints the result based on the comparison.
Question 52: What number would be shown on the screen after the following statements of C are executed?
- A 5
- B 6
- C 7
- D 8
Explanation: Since the ASCII value of G is 71 and the garbage value if A is 65 and hence the difference is 6.
Question 53: In the following code snippet, character pointer str holds a reference to the string . . . . . . . .
- A Examveda.com\0programming
- B Examveda.com
- C Examveda.comprogramming
- D Invalid declaration
Explanation: No explanation is given for this question
Question 54: Which one of the following is not a reserved keyword for C?
- A default
- B case
- C auto
- D main
Explanation: , reserved keywords are words that have predefined meanings and cannot be used as identifiers (such as variable names, function names, etc.). - This is a reserved keyword in C, used for automatic variables. - This is a reserved keyword in C, used in switch statements to specify different cases. - This is not a reserved keyword in C. Although is a commonly used function name for the entry point of a C program, it is not a reserved keyword. - This is a reserved keyword in C, used in switch statements as a default case. - This is a reserved keyword in C, used to define register variables for fast access. Therefore, the correct answer is .
Question 55: Which header file should be included for input and output functions in C?
- A <math.h>
- B <string.h>
- C <stdlib.h>
- D <stdio.h>
Explanation: The header file that should be included for input and output functions in C is . The header file provides declarations for functions like , , , and many others that are used for input and output operations in C. So, the correct answer is: Including this header file at the beginning of your C program allows you to use standard input and output functions to interact with the user and manipulate data.
Question 56: Which library function is used to allocate memory dynamically in C?
- A malloc
- B realloc
- C free
- D sizeof
Explanation: No explanation is given for this question
Question 57: What is the purpose of the 'continue' statement in a loop?
- A Skip the loop
- B Exit the program
- C Exit the loop
- D Skip the current iteration
Explanation: The purpose of the 'continue' statement in a loop is to and proceed to the next iteration of the loop. When 'continue' is encountered within a loop, it immediately terminates the current iteration and continues with the next iteration, effectively skipping any remaining code within the current iteration's body. So, the correct answer is:
Question 58: What is the significance of the 'volatile' keyword in C?
- A Indicate a volatile variable
- B Declare a constant
- C Allocate memory
- D Skip the current iteration
Explanation: No explanation is given for this question
Question 59: In C, which type of variable should be used to store decimal numbers?
- A char
- B float
- C double
- D int
Explanation: In C, you can indeed use the data type to store decimal numbers. However, it's important to note that is typically used for single-precision floating-point numbers, which have a lower precision and a more limited range compared to . So, to clarify: If you require high precision and a wide range for storing decimal numbers, is the more common choice. is a valid choice when you can tolerate slightly lower precision and a somewhat limited range, or when memory constraints are a concern, as typically requires less memory than . In summary, both and can be used to store decimal numbers, but the choice between them depends on your specific requirements for precision and range.