1. An escape sequence begins with a _____ character in 'C'.
JOA-IT 913 *
Correct :
Explanation: In C, an escape sequence begins with a backslash character (\). Escape sequences are used to represent characters that cannot be typed directly on the keyboard. Here are some examples of escape sequences in C:
\n - Newline character
\t - Tab character
\r - Carriage return character
\' - Backslash character
\" - Double quote character
2. Which of the following symbols represents the address opertor in C Language ?
JOA-IT 913 *
Correct : C
Explanation: The address-of operator in C is the ampersand (&) symbol. It is a unary operator that returns the memory address of its operand. The address of a variable can be used to pass the variable to a function by reference, or to allocate memory for an array or other data structure. Syntax : printf("The address of y is %p", &y);
3. Which of the following is not a valid hexadecimal number ?
JOA-IT 913 *
Correct : C
Explanation: The hexadecimal number system is a numerical representation with a base of 16. This means that there are only 16 possible digit values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. A, B, C, D, E, and F represent the decimal values 10, 11, 12, 13, 14, and 15 in single bits.
4. The modulo operator is represent using ______ symbol in C Language.
JOA-IT 913 *
Correct : D
Explanation: The modulo operator in C Language is represented by the percentage symbol (%). It is used to find the remainder of a division operation between two integers. For example, the expression 10 % 3 would evaluate to 1, because 10 divided by 3 equals 3 with a remainder of 1.
5. What is decimal number represented by (10101010)2 number in binary number system ?
JOA-IT 913 *
Correct : C
Explanation: To convert the binary number (10101010)_2 to decimal, we can use the following process:
(10101010)2 = 1 * 2^7 + 0 * 2^6 + 1 * 2^5 + 0 * 2^4 + 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 0 * 2^0
= 128 + 0 + 32 + 0 + 8 + 0 + 2 + 0
= 170
6. A/An _____ reads one statement at a time, translate in into machine codes, executes it and then goes to the next statement of the program.
JOA-IT 913 *
Correct : B
Explanation: An interpreter is a program that can execute code written in a high-level language without first compiling it into machine code. Instead, the interpreter reads the code one statement at a time and translates it into machine code before executing it. This process is repeated until the entire program has been executed.
7. Which is a derived data type in C language that consist of different members sharing the same memory location ?
JOA-IT 817 *
Correct : C
Explanation: In the C programming language, a union is a derived data type that consists of different members that share the same memory location. Points to be remember : All members of a union share the same memory location. A union can store different data types in the same memory region. Only one member of a union can have a value at any given time. Unions are often used to conserve memory when only one member of the union is active at a time.
8. In C language, all the preprocessor directives begin with with a which character ?
JOA-IT 817 *
Correct : B
Explanation: In C language, all preprocessor directives begin with a hash symbol (#). The preprocessor is a part of the compiler that performs preliminary operations to your code before the compiler sees it. Some examples of preprocessor directives include: #define, #undef, #if, #else, #elif.
9. The bitwise exclusive operator in C language has two variants called pre and post ?
JOA-IT 817 *
Correct : B
Explanation: The bitwise exclusive operator in C language has two variants called pre and post. The pre-increment operator (++x) increments the value of the variable x before using it in an expression. The post-increment operator (x++) increments the value of the variable x after using it in an expression.
10. In C language, all the character strings terminate with which character ?
JOA-IT 817 *
Correct : A
Explanation: In the C programming language, character strings are terminated with the null character, represented by '\0'. This null character is used to indicate the end of the string.
11. Which of the following standard library function in C language is used for formatted output ?
JOA-IT 817 *
Correct : D
Explanation : The printf() function is used for formatted output to standard output based on a format specification. The output data and the format specification string act as the parameters of the printf() function.
12. What is the format specifier used in scanf() to read a single character from the standart input ?
JOA-IT 817 *
Correct : D
Explanation: In C programming, the format specifier %c is used in the scanf() function to read a single character from the standard input.
13. What will be the output produced by the following code segment in a C program ?
int a = 5, b;
b = ++a + 7/2;
printf ('%d', b);
JOA-IT 817 *
Correct : A
Explanation: Solve ++a increments the value of a before its value is used in the expression. So, a becomes 6.
7/2 performs integer division, which results in 3 (because 7 divided by 2 is 3 with a remainder).
The sum of ++a and 7/2 is 6 + 3 = 9.
The value of b is assigned as 9.
The printf statement prints the value of b.
14. What will be the output produced by the following code segment in a C program ?
int a=7, b=8;
printf("%d", a & b);
JOA-IT 817 *
Correct : C
Explanation: The code segment performs a bitwise AND operation between the values of variables a and b and then prints the result using printf. The bitwise AND operator (&) performs a bitwise AND operation between the corresponding bits of the two operands. In binary, the result is 0000, which is 0 in decimal.
15. Which of the following statements is not true about variable in C programming language ?
JOA-IT 817 *
Correct : D
Explanation: A variable in C programming language is a named memory location that can store data. The value of a variable can be changed during the execution of the program. You can then assign a value to the variable using the assignment operator (=). Example : x = 10.
16. If the size of short data type in a C implementation is 2 bytes, then what is the maximum value that can be stored in a variable with this type ?
JOA-IT 817 *
Correct : C
Explanation: For signed int which have 2 bytes (16 bits ) can stored value range -32,768 to +32,767.
17. What is the decimal representation of the 2's complement number 1101011 ?
JOA-IT 817 *
Correct : D
Explanation: Invert all the bits (1101011): 0010100. Now, Add 1 at last : 0010100 + 1 = 0010101. Therefore, the 2's complement of 1101011 is 0010101. Now convert (0010101) to decimal number which is 24+22+20 = 16+4+1 = 21. The leftmost bit of the binary number 1101011 is 1 which is why, it indicates a negative number.
18. How many bits are used for fractional part in IEEE floating point single precision representation ?
JOA-IT 817 *
Correct : C
Explanation: The IEEE 754 standard for single-precision floating-point numbers uses 23 bits for the fractional part. The standard uses a 32-bit format, which includes: 1 sign bit, 8 exponent bits, 23 fraction bits.
19. Who among the following is the developer of 'C' language ?
Correct : D
Explanation: Dennis M. Ritchie developed the C programming language in 1972 at Bell Telephone Laboratories. The language was created to help build the UNIX operating system and to overcome issues with previous languages like B.
20. Keywords in C are in which case ?
Correct : A
Explanation: Here is a list of all 32 keywords in C:
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
inline
int
long
register
restrict
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while