The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Explanation An identifier is a name that starts with letters or an underscore. It is used to identify variables, functions, classes, or any other user-defined item in a program. Identifiers cannot be the same as reserved keywords, which are predefined words with special meanings in the programming language. Tokens are the individual units of a program, including identifiers, keywords, operators, and literals. Therefore, the correct answer is identifiers.
Rate this question:
2.
The words if, else, auto, float etc. have predefined meaning and users cannot use them as variables. These words are called
A.
Constant
B.
Identifier
C.
Keywords
D.
Data types
Correct Answer
C. Keywords
Explanation The words if, else, auto, float etc. have predefined meanings in programming languages and cannot be used as variables. They are reserved words that have specific functionalities within the language. These words are commonly referred to as keywords.
Rate this question:
3.
An expression contains relational, assignment and arithmetic operators. If parenthesis are not specified, the order of evaluation of the operators would be:
A.
Assignment, arithmetic, relational
B.
Arithmetic, relational, assignment
C.
Assignment, relational, arithmetic
D.
Relational, assignment, arithmetic
Correct Answer
B. Arithmetic, relational, assignment
Explanation The given answer is "arithmetic, relational, assignment". In an expression without specified parentheses, the arithmetic operators are evaluated first, followed by the relational operators, and finally the assignment operators. This order ensures that any necessary calculations are performed before making comparisons and assigning values to variables.
Rate this question:
4.
In an assignment statement a=b; which of the following statement is true ?
A.
The variable a and the variable b are same.
B.
The value of b is assigned to variable a but if b changes later, it will not effect the value of variable a.
C.
The value of b is assigned to variable a but if b changes later, it will effect the value of variable a
D.
The value of variable a is assigned to variable b, and the value of variable b is asssigned to variable a.
Correct Answer
B. The value of b is assigned to variable a but if b changes later, it will not effect the value of variable a.
Explanation The correct answer is that the value of b is assigned to variable a but if b changes later, it will not affect the value of variable a. This is because in an assignment statement, the value of the variable on the right side of the assignment operator (=) is assigned to the variable on the left side. However, any changes made to the variable on the right side after the assignment will not affect the value of the variable on the left side.
Rate this question:
5.
Which is an incorrect variable name?
A.
Id_No
B.
ID_NO_23
C.
Id No
D.
IdNo12
Correct Answer
C. Id No
Explanation The variable name "Id No" is incorrect because it contains a space, which is not allowed in variable names. Variable names should not have spaces or special characters, and should be written in a way that is clear and meaningful.
Rate this question:
6.
If 'a' is an integer variable, then a=5/2 will return a value
A.
2.5
B.
2
C.
3
D.
2.5
Correct Answer
B. 2
Explanation The expression "a=5/2" assigns the value of the division 5/2 to the variable 'a'. In integer division, the result is the quotient without any decimal places. Therefore, the result of 5/2 is 2, and this value will be assigned to 'a'.
Rate this question:
7.
Which of the following is not a premitive data type in 'C' language?
A.
Double
B.
Array
C.
Char
D.
Float
Correct Answer
B. Array
Explanation In the 'C' language, double, char, and float are all primitive data types. However, array is not a primitive data type in 'C'. An array is a collection of elements of the same data type, and it is considered a derived data type in 'C'.
Rate this question:
8.
Which of the following cannot be used as identifiers independely ?
A.
Letters
B.
Numbers
C.
Spaces
D.
Underscores
Correct Answer
C. Spaces
Explanation Spaces cannot be used as identifiers independently because spaces are not allowed in variable or identifier names. In programming languages, spaces are used to separate different parts of a statement or expression. Therefore, using spaces as identifiers would result in a syntax error.
Rate this question:
9.
Identify the correct sequence of steps to run a program
A.
Code, compile, link, load and execute
B.
Link, load, code, compile and execute
C.
Code, compile, link, execute and load
D.
Compile, code, link, load and execute
Correct Answer
A. Code, compile, link, load and execute
Explanation The correct sequence of steps to run a program is to first write the code, then compile it to convert it into machine-readable instructions, followed by linking the compiled code with any necessary libraries or dependencies. After that, the program is loaded into memory, and finally, it is executed or run.
Rate this question:
10.
Which operators are used to compare the values of operands to produce logical value in C language?
A.
Logical operator
B.
Relational operator
C.
Assignment operator
D.
None of the above
Correct Answer
B. Relational operator
Explanation Relational operators are used to compare the values of operands in C language. These operators compare two values and return a logical value (true or false) based on the comparison. Examples of relational operators in C include equal to (==), not equal to (!=), greater than (>), less than (=), and less than or equal to (
Rate this question:
11.
An operator used to check a condition and select a value depending on the value of the condition is called
A.
Logical operator
B.
Decrement operator
C.
Conditional or Ternary operator
D.
Bitwise operator
Correct Answer
C. Conditional or Ternary operator
Explanation The conditional or ternary operator is used to check a condition and select a value based on the result of that condition. It allows for concise and efficient code by providing a shorthand way to write if-else statements. The operator consists of a condition followed by a question mark, then a value to be returned if the condition is true, and a colon followed by a value to be returned if the condition is false. This operator is commonly used in programming languages like C, C++, and Java.
Rate this question:
12.
Which of the follwing symbol is format specifier?
A.
&
B.
:
C.
%d
D.
;
Correct Answer
C. %d
Explanation The symbol "%d" is a format specifier. In programming, format specifiers are used to define the type and format of data that should be printed or read. In this case, "%d" is used to format and print an integer value.
Rate this question:
13.
Which constant can be expressed both in fractional and exponential forms?
A.
Char
B.
Void
C.
Int
D.
Float
Correct Answer
D. Float
Explanation The constant "float" can be expressed both in fractional and exponential forms. In fractional form, it represents a decimal number with a fractional part, such as 3.14. In exponential form, it can be expressed as a number multiplied by a power of 10, such as 3.14 x 10^1. This flexibility allows for greater precision and a wider range of values compared to other data types like "char", "void", and "int".
Rate this question:
14.
? and : are called
A.
Relational Operators
B.
Conditional Operators
C.
Logical Operators
D.
Arithmetic Operators
Correct Answer
B. Conditional Operators
Explanation The symbols "?" and ":" are called conditional operators because they are used to create conditional expressions in programming languages. These operators evaluate a condition and return one of two values based on the result of the condition. The "?" symbol is used to specify the condition, while the ":" symbol is used to separate the two possible values. This allows for concise and efficient coding of conditional statements.
Rate this question:
15.
Which of the following is the valid variable name?
A.
Dot.
B.
Number
C.
Stack-queue
D.
#hash
Correct Answer
B. Number
Explanation The variable name "number" is valid because it starts with a letter, which is a requirement for variable names in most programming languages. Additionally, it does not contain any special characters or symbols, and it consists of only alphanumeric characters.
Rate this question:
16.
Which of the following is invalid C constant?
A.
35,550
B.
325.00E+325.00
C.
0.00E+0.00
D.
2
Correct Answer
A. 35,550
Explanation The constant "35,550" is invalid because it contains a comma, which is not allowed in C constants. C constants can only consist of digits and a decimal point (if it is a floating-point constant).
Rate this question:
17.
Size of the interger that is supported by gcc compiler is:
A.
4-bits
B.
2-bits
C.
2 Bytes
D.
4 Bytes
Correct Answer
D. 4 Bytes
Explanation The size of the integer supported by the gcc compiler is 4 Bytes. This means that the compiler can handle integers that occupy 4 bytes of memory. This is a common size for integers on many systems, as it allows for a wide range of values to be stored.
Rate this question:
18.
How many keywords are there in C Language?
A.
23
B.
32
C.
31
D.
None of the above
Correct Answer
B. 32
Explanation There are 32 keywords in the C Language. Keywords are reserved words that have a specific meaning in the programming language and cannot be used as variable names or identifiers. These keywords are predefined and have a specific purpose in the C Language syntax.
Rate this question:
19.
Associativity of = operator is.
A.
Left to right
B.
Right to left
C.
Assignement
D.
All of the above
Correct Answer
B. Right to left
Explanation The associativity of the = operator is right to left. This means that when there are multiple assignments in a single line of code, the rightmost assignment is evaluated first and then the result is assigned to the leftmost variable. For example, in the expression "a = b = c", the value of c is assigned to b first, and then the value of b is assigned to a.
Rate this question:
20.
Which of the follwing is a ternary operator
A.
:?
B.
?:
C.
??
D.
?::
Correct Answer
B. ?:
Explanation The ternary operator is a conditional operator that takes three operands. It is represented by the symbol "?:". The first operand is a condition, the second operand is the value returned if the condition is true, and the third operand is the value returned if the condition is false. Therefore, the correct answer is ?: as it represents the ternary operator.
Rate this question:
21.
C language programs are converted into machine language by
A.
Interpreter
B.
Assembler
C.
Compiler
D.
All of the above
Correct Answer
C. Compiler
Explanation C language programs are converted into machine language by a compiler. A compiler is a software program that translates the entire source code written in a high-level programming language like C into machine code that can be understood and executed by the computer's processor. The compiler performs various tasks such as lexical analysis, syntax analysis, semantic analysis, optimization, and code generation to convert the code into machine language. Therefore, a compiler is the correct answer for this question.
Rate this question:
22.
Operator & is used for
A.
Bitwise AND
B.
Bitwise OR
C.
Bitwise NOT
D.
None of the above
Correct Answer
A. Bitwise AND
Explanation The operator "&" is used for performing a bitwise AND operation. Bitwise AND compares the corresponding bits of two numbers and returns a new number where each bit is set to 1 only if both corresponding bits in the original numbers are 1. This operator is commonly used in programming to manipulate individual bits within binary numbers.
Rate this question:
23.
In the passage of text, individual words and punctuation marks are known as
A.
Constant
B.
Keywords
C.
Delimiter
D.
Operators
Correct Answer
C. Delimiter
Explanation In the passage of text, individual words and punctuation marks are known as delimiters. Delimiters are used to separate or mark the boundaries between different elements in a text, such as words or sentences. They help to identify the structure and meaning of the text by indicating where one element ends and another begins. In this context, delimiters refer to both individual words and punctuation marks that serve this purpose.
Rate this question:
24.
The result of a relational operator is always
A.
Greater than or Less than
B.
Greater Than or Equal to
C.
True OR False
D.
False OR False
Correct Answer
C. True OR False
Explanation The result of a relational operator can be either true or false, depending on the comparison being made. For example, if we compare two numbers using the greater than operator, the result will be true if the first number is indeed greater than the second number, and false otherwise. Similarly, if we compare two strings using the equal to operator, the result will be true if the two strings are equal, and false otherwise. Therefore, the correct answer is "True OR False" because the result of a relational operator can be either true or false.
Rate this question:
25.
Which of the following is not a valid declaration in C?
A.
Short int x
B.
Signed short x
C.
Short x
D.
Unsigned short x
Correct Answer
D. Unsigned short x
Explanation All the given declarations are valid in C except for "unsigned short x". In C, the "unsigned" keyword is used to declare variables that can only hold positive values or zero. However, "short" is a valid data type in C, and it can be used with or without the "signed" keyword. Therefore, the declaration "unsigned short x" is not valid because it combines the "unsigned" and "short" keywords, which is not allowed in C.
Rate this question:
26.
Int main() {char a = 'a'; printf("%d", a); return 0;}
A.
Compiler Error
B.
A
C.
65
D.
97
Correct Answer
D. 97
Explanation The given code snippet declares a variable 'a' of type char and assigns it the value 'a'. The printf statement is used to print the value of 'a' as an integer using the %d format specifier. In ASCII, the character 'a' has an integer value of 97. Therefore, the code will output 97.
Rate this question:
27.
Int main() {char a = 125'; a = a + 10; printf("%d", a); return 0;}
A.
Compiler Error
B.
125
C.
-121
D.
-135
Correct Answer
C. -121
Explanation In this code, the variable 'a' is declared as a char with an initial value of 125. Then, 'a' is incremented by 10. However, since a char can only hold values from -128 to 127, the value of 'a' overflows and wraps around to -121. Therefore, when the value of 'a' is printed using printf, it will display -121.
Rate this question:
28.
For a 2 bit integer int main() {int a = 40000; printf("%d", a); return 0;}
A.
40000
B.
32768
C.
-25536
D.
Compiler Error
Correct Answer
C. -25536
Explanation The given code declares an integer variable 'a' and assigns it a value of 40000. However, since a 2-bit integer can only represent values from -2^(n-1) to 2^(n-1)-1 (where n is the number of bits), the value 40000 is outside the range and overflows. As a result, the value of 'a' becomes -25536, which is the equivalent value after the overflow. Thus, the correct answer is -25536.
Rate this question:
29.
Int main() { printf("%d", sizeof(long long int)); }
A.
Warning Message related to int
B.
6
C.
8
D.
Both (A) and (B)
Correct Answer
D. Both (A) and (B)
Explanation The correct answer is both (A) and (B). The warning message related to int is because the code is using the %d format specifier in the printf function, which expects an int argument. However, the sizeof operator returns a value of type size_t, which is typically an unsigned integer type. Therefore, there is a mismatch between the format specifier and the argument type, resulting in a warning. The value printed is 8, which is the size in bytes of a long long int on the particular system where the code is being executed.
Rate this question:
30.
Int main() { printf("%d", sizeof(long long double)); }
A.
Error
B.
16
C.
6
D.
Both (A) and (B)
Correct Answer
A. Error
Explanation The code will produce an error because "long long double" is not a valid data type in C. It seems to be a combination of two different data types, "long long" and "double", which are not allowed to be combined in this way. Therefore, the code will not compile and an error will be thrown.
Rate this question:
31.
Int main() { int a =1; printf("%d%d%d", a, a++, ++a);
A.
323
B.
112
C.
212
D.
333
Correct Answer
A. 323
Explanation The code snippet starts by initializing the variable 'a' with a value of 1. Then, the printf statement is used to print the values of 'a', 'a++', and '++a'.
The expression 'a++' means that the current value of 'a' is used in the printf statement, and then 'a' is incremented by 1. So, the first 'a' in the printf statement will be 1.
The expression '++a' means that 'a' is incremented by 1, and then the new value of 'a' is used in the printf statement. So, the third 'a' in the printf statement will be 3.
Therefore, the output of the printf statement will be "323", which matches the given answer.
Rate this question:
32.
Int main() { int b =1; printf("%d%d%d", b++, b, b++);
A.
123
B.
231
C.
331
D.
321
Correct Answer
B. 231
Explanation The expression `b++` is a post-increment operator, which means that the value of `b` is incremented after it is used in the expression. In the `printf` statement, the order of evaluation is from right to left. So, `b++` is evaluated first and the value of `b` becomes 2. Then, `b` is evaluated as 2 in the second `b` in the `printf` statement. Finally, `b++` is evaluated again and the value of `b` becomes 3. Therefore, the output is "231".
Rate this question:
33.
Int main() { printf("%d", 3|4);
A.
0
B.
5
C.
7
D.
3
Correct Answer
C. 7
Explanation The bitwise OR operator "|" is used to perform a bitwise OR operation on the binary representations of two integers. In this case, the binary representation of 3 is 0011 and the binary representation of 4 is 0100. Performing the OR operation on these two binary numbers results in 0111, which is equal to 7 in decimal form. Therefore, the correct answer is 7.
Rate this question:
34.
Int main() { printf("%d", 3
A.
2
B.
3
C.
6
D.
1
Correct Answer
C. 6
Explanation The given code prints the result of the expression "3
Rate this question:
35.
Int main() { printf("%d", 3>>1);
A.
3
B.
1
C.
2
D.
0
Correct Answer
B. 1
Explanation The expression "3>>1" is a right shift operation in C. In this case, it means shifting the bits of the number 3 to the right by 1 position. Shifting a number to the right by 1 is equivalent to dividing it by 2. Therefore, the result of "3>>1" is 1.
Rate this question:
36.
Int main() { printf("%d", 0&&4);
A.
0
B.
4
C.
1
D.
2
Correct Answer
A. 0
Explanation The code snippet `printf("%d", 0&&4);` uses the logical AND operator (`&&`) to evaluate the expression `0&&4`. In this case, the expression evaluates to `0` because both operands are non-zero values. According to the rules of the logical AND operator, if any of the operands is `0`, the result is `0`. Therefore, the output of the `printf` statement will be `0`.
Explanation The given code snippet defines a macro function ISEQUAL(X, Y) which checks if X is equal to Y. In the main function, X and Y are declared as integers. Then, the printf statement prints the result of calling the ISEQUAL macro with X as the first argument and 0 as the second argument. Since X is not initialized, its value is undefined. Therefore, the result of the comparison X==0 is unpredictable, and the output can be either 1 or 0.
Explanation The code defines a macro function ISEQUAL that takes two arguments X and Y and checks if X is equal to Y using the equality operator ==. In the main function, variables X and Y are declared. The printf statement prints the result of calling the ISEQUAL macro function with X as the first argument and 1 as the second argument. Since X is not initialized, its value is undefined, and the result of the comparison will be unpredictable. Therefore, the output could be any value, but it is most likely to be 0.
Rate this question:
39.
Int a; a=5&&4; printf("%d", a);
A.
1
B.
0
C.
Both A and B
D.
None
Correct Answer
A. 1
Explanation The expression "5 && 4" is a logical AND operation. In C programming, the logical AND operator (&&) returns true (1) if both operands are non-zero, and false (0) otherwise. Since both 5 and 4 are non-zero, the result of the logical AND operation is true (1). Therefore, the value of the variable "a" is 1. When we use the printf function to print the value of "a", it will output "1".
Rate this question:
40.
Int a; a=5&4; printf("%d", a);
A.
0
B.
4
C.
5
D.
1
Correct Answer
D. 1
Explanation The code initializes the variable 'a' and assigns it the result of the bitwise AND operation between 5 and 4. The bitwise AND operation compares the binary representation of the two numbers and returns a new number where each bit is set to 1 only if the corresponding bits in both numbers are also 1. In this case, the binary representation of 5 is 101 and the binary representation of 4 is 100. Performing the bitwise AND operation, we get 100, which is equal to 4 in decimal. Therefore, the correct answer is 4.
Rate this question:
41.
Int a; a=15^13; printf("%d", a);
A.
3
B.
4
C.
2
D.
10
Correct Answer
C. 2
Explanation The given code calculates the bitwise XOR of 15 and 13, which results in 2. The XOR operation compares the corresponding bits of two numbers and returns 1 if they are different, and 0 if they are the same. In this case, the binary representation of 15 is 1111 and the binary representation of 13 is 1101. When performing the XOR operation, the bits that are different are set to 1, resulting in the binary representation of 2, which is 0010. Therefore, the value of variable 'a' is 2, and when printed using printf, it will display 2.
Rate this question:
42.
Identify the correct way of variable declearation
A.
1A_B
B.
A_B
C.
If
D.
AB@3
Correct Answer
B. A_B
Explanation The correct way of variable declaration is A_B. Variable names can only contain letters, numbers, and underscores, and must start with a letter or an underscore. The option 1A_B is incorrect because it starts with a number. The option "if" is incorrect because it is a reserved keyword in most programming languages and cannot be used as a variable name. The option AB@3 is incorrect because it contains a special character (@) which is not allowed in variable names.
Rate this question:
43.
Name of compiler to run c program on linux opetating system
A.
Gcc
B.
Cc
C.
Both
D.
None
Correct Answer
C. Both
Explanation Both gcc and cc are compilers that can be used to run C programs on a Linux operating system. The gcc compiler is the most commonly used compiler for C programs on Linux. However, cc is also a compiler that is available on some Linux systems and can be used to compile and run C programs. Therefore, both gcc and cc are valid options for running C programs on a Linux operating system.
Rate this question:
44.
Int a; a=5||0; printf("%d", a);
A.
8
B.
0
C.
1
D.
5
Correct Answer
B. 0
Explanation In this code, the variable "a" is assigned the value of the logical OR operation between 5 and 0. The logical OR operator returns true (1) if either of the operands is true, and false (0) if both operands are false. In this case, 5 is considered true, and 0 is considered false. Since the logical OR operation only needs one true value to return true, the value of "a" is 1. However, when printing "a" using the printf function, the format specifier %d is used, which is used to print integers. Therefore, the value of "a" is printed as 0.
Rate this question:
45.
Int a; a=10>>1; printf("%d", a);
A.
5
B.
10
C.
20
D.
1
Correct Answer
A. 5
Explanation The given code assigns the value 10 to the variable 'a' and then performs a right shift operation on 'a' by 1 bit. The right shift operation divides 'a' by 2, effectively halving its value. Therefore, the value of 'a' after the right shift operation is 5. The code then prints the value of 'a', which is 5.
Rate this question:
46.
Int a; a=10
A.
5
B.
10
C.
20
D.
1
Correct Answer
C. 20
Explanation The given code declares a variable 'a' and assigns it a value of 10. However, the value of 10 is not used or referenced in any way. The next line of code is 20, which means that the value 20 is the output or result of the code.
Rate this question:
47.
Keyword to define any constant variable
A.
Const
B.
Con
C.
Cons
D.
Constant
Correct Answer
A. Const
Explanation The correct answer is "const". In programming, the keyword "const" is used to define a constant variable. A constant variable is a value that cannot be changed once it is assigned. By using the "const" keyword, the programmer can ensure that the value of the variable remains constant throughout the program.
Rate this question:
48.
Int x=23, y; y= x--; printf("%d%d", x, y);
A.
22, 22
B.
23, 23
C.
22, 23
D.
23, 22
Correct Answer
C. 22, 23
Explanation In this code snippet, the variable x is initially assigned the value 23. Then, the post-decrement operator (--) is used to decrement the value of x by 1. However, since the post-decrement operator is used, the value of x is first assigned to y and then decremented. Therefore, the value of y remains 23. Finally, the printf statement prints the values of x and y, which are 22 and 23 respectively.
Rate this question:
49.
Which language does not need any translator?
A.
Machine language
B.
High level language
C.
Assembly language
D.
None
Correct Answer
A. Machine language
Explanation Machine language does not need any translator because it is the lowest-level programming language that can be directly understood and executed by a computer's hardware. It consists of binary code instructions that are specific to the computer's architecture. As a result, no translation or interpretation is required for the computer to understand and execute the instructions in machine language.
Rate this question:
50.
Algorithm should be
A.
Precise
B.
Unambiguous
C.
Both
D.
None
Correct Answer
C. Both
Explanation The algorithm should be both precise and unambiguous. Being precise means that the algorithm should provide clear and specific instructions, leaving no room for interpretation. This ensures that the algorithm can be executed accurately and consistently. Being unambiguous means that the algorithm should have only one possible interpretation, eliminating any confusion or ambiguity in understanding the steps. By being both precise and unambiguous, the algorithm can be easily understood and implemented by both humans and computers.
Rate this question:
Quiz Review Timeline +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.