1.
Character Set of C language contains ?
Correct Answer
D. All of these
Explanation
The character set of the C language includes alphabets, digits, and special symbols. This means that any combination of letters, numbers, and special characters can be used in C programming. Therefore, the correct answer is "All of these."
2.
A variable name can have ?
Correct Answer
D. Underscore
Explanation
A variable name can have an underscore because it is a valid character in most programming languages to separate words within a variable name. It is commonly used to improve readability and make the variable name more descriptive. Using an underscore can make the variable name more meaningful and easier to understand, especially when the variable name consists of multiple words.
3.
In C language , one of the following is not a valid data type
Correct Answer
A. Long
Explanation
In C language, long is a valid data type. It is used to store larger integer values than the int data type. The long data type occupies more memory space compared to the int data type. Other valid data types in C language are float, double, and char. Float and double are used to store floating-point numbers, while char is used to store single characters.
4.
The format string %lf is used for ?
Correct Answer
D. Long double
Explanation
The format string %lf is used for long double because the 'l' in %lf stands for "long" and 'f' stands for "float". Therefore, %lf is used to format and print long double values.
5.
A variable of type unsigned int can have a value in the range of ?
Correct Answer
C. 0 to 65535
Explanation
A variable of type unsigned int can have a value in the range of 0 to 65535. Unsigned int is a data type that only allows positive integers or zero, and it can store values up to 2^16 - 1, which is 65535. The range starts from 0 because it does not allow negative values.
6.
Which data type is not a primary data type
Correct Answer
B. Array
Explanation
The given options are int, array, float, and char. Out of these options, array is not a primary data type. In programming, a primary data type refers to the basic data types that are built-in and provided by the programming language itself. These primary data types include int, float, and char. However, array is not a primary data type as it is a composite data type that allows storing multiple values of the same data type.
7.
Which of the format string is not valid ?
Correct Answer
D. %lc
Explanation
The format string "%lc" is not valid because the "%lc" format specifier is used for wide characters in some programming languages, such as C, but it is not a valid format specifier in most common programming languages like C++, Java, or Python. The correct format specifier for a wide character is "%lc" or "%C".
8.
Which is the valid string data
Correct Answer
C. "A"
Explanation
The valid string data in this case is "A" because it is enclosed within double quotation marks. The other options, 'A' and A, are not valid string data as they are not enclosed within quotation marks. The option "None of these" is not a valid string data either as it does not represent any specific string value.
9.
How much memory is required to store a value of type double ?
Correct Answer
C. 8 bytes
Explanation
A value of type double requires 8 bytes of memory. The double data type is used to store decimal numbers with a higher precision compared to the float data type. It occupies 64 bits of memory, allowing it to hold a wider range of values with greater accuracy.
10.
The modifier which is used to declare a variable as constant
Correct Answer
D. Const
Explanation
The correct answer is "const". The const modifier is used to declare a variable as constant, meaning its value cannot be changed once it has been assigned.