1.
Do while loop tests the condition at the End of the Loop.
Correct Answer
B. False
Explanation
The explanation for the given correct answer is that a do-while loop tests the condition at the end of the loop. This means that the loop will always execute at least once, regardless of the condition. After the loop body is executed, the condition is checked, and if it evaluates to true, the loop will continue. If the condition is false, the loop will terminate. Therefore, the statement "Do while loop tests the condition at the End of the Loop" is false.
2.
The Symbol && is read as ____________________.
Correct Answer
B. OR
Explanation
The symbol && is commonly read as "AND" in computer programming languages, but in this case, the correct answer is "OR." This may be due to a typographical error or a misunderstanding of the question. The symbol || is typically used to represent "OR" in programming, while && represents the logical "AND" operation.
3.
What type of errors are checked during compilation
Correct Answer
D. Syntax errors
Explanation
During compilation, the compiler checks for syntax errors in the code. Syntax errors occur when the code does not follow the rules and structure of the programming language. These errors can include missing semicolons, incorrect variable declarations, or using incorrect syntax for loops or conditionals. The compiler identifies these errors and provides error messages to the programmer, indicating the specific line or section of code that needs to be corrected.
4.
The purpose of main function is
Correct Answer
D. To start program execution
Explanation
The main function is the entry point of a program. It is where the program starts its execution. Therefore, the purpose of the main function is to start program execution.
5.
What is the valid identifier in the following
Correct Answer
D. Q1234
Explanation
The valid identifier in the given options is "q1234". In programming, an identifier is a name given to a variable, function, or any other user-defined item. It must follow certain rules, such as starting with a letter or underscore, and can contain letters, numbers, or underscores. "q1234" satisfies these rules and can be considered a valid identifier.
6.
What is range of char data value?
Correct Answer
B. -128 to 127
Explanation
The range of char data value is -128 to 127. This means that a char variable can hold any integer value between -128 and 127, inclusive. The char data type in most programming languages is typically used to store single characters, but it can also be used to store small integers within this range.
7.
The minimum number of temporary variable needed to swap the contents of two variable is
Correct Answer
C. 0
Explanation
To swap the contents of two variables, we can use a temporary variable to hold the value of one variable while we assign the value of the other variable to it. However, in this case, the answer is 0 because we can perform the swap operation without using any temporary variable. This can be achieved by using arithmetic operations like addition and subtraction. By adding the value of one variable to the other and then subtracting the original value of the second variable from the sum, we can effectively swap their contents.
8.
In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first?
Correct Answer
D. 6.6/a
Explanation
The operation that will be performed first in the given expression is 6.6/a. This is because division has a higher precedence than addition and multiplication. Therefore, the expression will be evaluated from left to right, and the division 6.6/a will be performed before any other operations.
9.
Which of the following is an incorrect variable name.
Correct Answer
A. Else
Explanation
The variable name "else" is incorrect because it is a reserved keyword in many programming languages, including Python. Reserved keywords have special meanings and cannot be used as variable names. Therefore, using "else" as a variable name would result in a syntax error.
10.
Variables are initialized in C, using
Correct Answer
C. =
Explanation
In C, variables are initialized using the "=" operator. This operator is used to assign a value to a variable. For example, if we want to initialize a variable named "x" with the value 10, we would write "x = 10". The "=" operator is used for assignment, while the "==" operator is used for comparison. So, the correct answer is "=" as it is used for initialization of variables in C.
11.
In the following, which is bitwise operator?
Correct Answer
C. |
Explanation
The correct answer is |. The vertical bar or pipe symbol (|) is a bitwise OR operator. It performs a binary OR operation on each pair of corresponding bits in two operands. The result is 1 if either of the bits is 1, otherwise, it is 0.
12.
What is output of the following program?
main()
{int a;
float b;
a=1/2;
b=1.0/2.0;
printf(“ a=%d b=%f”,a,b);
}
Correct Answer
B. A=0 b=0. 5
Explanation
The output of the program will be "a=0 b=0.5". This is because in the line "a=1/2", the division is performed using integer division, which truncates the decimal part and assigns the result to the integer variable a. As a result, a is assigned the value 0. On the other hand, in the line "b=1.0/2.0", the division is performed using floating-point division, which retains the decimal part. Therefore, b is assigned the value 0.5.
13.
Representing various steps in a flow diagram is called as
Correct Answer
B. Flow chart
Explanation
The correct answer is "flow chart" because a flow chart is a graphical representation of a process or workflow. It uses different symbols and shapes to represent various steps or actions in a sequence. It helps in visualizing the flow of information or tasks and is commonly used in programming, business processes, and problem-solving.
14.
What are the smallest individual units in a program
Correct Answer
D. Tokens
Explanation
Tokens are the smallest individual units in a program. They represent the basic building blocks of a program and include keywords, operators, identifiers, constants, and punctuation symbols. Each token has a specific meaning and is used to construct statements and expressions in a program. Tokens are important for the compiler or interpreter to understand the program's structure and syntax.
15.
The operator ++ is called as operator
Correct Answer
B. Increment
Explanation
The operator ++ is called the increment operator. It is used to increment the value of a variable by 1. This operator is commonly used in loops and in situations where we need to increase the value of a variable by a specific amount. It is a shorthand notation for adding 1 to a variable.
16.
Which of the following is not a relational operator
Correct Answer
B. &&
Explanation
The correct answer is &&. In programming, relational operators are used to compare values and determine the relationship between them. The && operator is a logical operator, not a relational operator. It is used to perform logical AND operation on two boolean values. Relational operators include != (not equal to) and > (greater than), which are used to compare values for equality and determine if one value is greater than another, respectively.
17.
main ( ) { int m,y;
m = 5;
y = ++m;
printf(”%d %d”,m,y);} consider the above code and find the output
Correct Answer
C. 6,6
Explanation
In the given code, the variable "m" is initialized with the value 5. Then, the value of "m" is incremented by 1 using the pre-increment operator (++m). This means that the value of "m" becomes 6. The value of "m" is then assigned to the variable "y". So, the value of "y" also becomes 6. Finally, the printf statement prints the values of "m" and "y", which are both 6. Hence, the output of the code is "6,6".
18.
Int C; C=25/2; What is the value of C
Correct Answer
D. 12
Explanation
The value of C is 12 because when dividing two integers, the result is an integer. In this case, 25 divided by 2 equals 12 with a remainder of 1. Since the result must be an integer, the remainder is ignored and the value of C is 12.
19.
Which of the following cannot be used as an identifier.
Correct Answer
C. Keywords
Explanation
Keywords cannot be used as identifiers because they are reserved words in a programming language that have predefined meanings. Using a keyword as an identifier would result in a syntax error or unexpected behavior in the program.
20.
Size of (double) returns
Correct Answer
B. 8
Explanation
The size of a variable of type double in most programming languages is typically 8 bytes. This means that when a double variable is declared and initialized, it will occupy 8 bytes of memory. The size of a double is usually larger than other data types like int or float because it can store larger and more precise decimal numbers. Therefore, the correct answer for the given question is 8.
21.
The ___________________ loop executes at least once.
Correct Answer
A. Do while
Explanation
The do while loop executes at least once because it first executes the code block and then checks the condition. This means that even if the condition is initially false, the code block will still be executed once before the condition is checked.
22.
An ___________________ is a collection of variables having same data type
Correct Answer
A. Array
Explanation
An array is a collection of variables having the same data type. This means that all the elements in an array are of the same type, such as integers, characters, or floating-point numbers. Arrays allow for efficient storage and access of multiple values of the same data type, as they provide a way to store and retrieve elements using an index. By using arrays, we can group related data together and perform operations on the entire collection of elements simultaneously.
23.
What will be the output of the following program?
#include
int main()
{
int a = 1, b = 2, c = 3;
printf("The value of a is %d", a);
a+=3;
printf(" The value of a is %d", a);
return 0;
}
Correct Answer
C. The value of a is 1 The value of a is 4
Explanation
The output of the program will be "The value of a is 1 The value of a is 4". This is because initially the value of 'a' is 1, which is printed. Then, 'a' is incremented by 3 using the compound assignment operator '+='. Therefore, the new value of 'a' is 4, which is printed in the second printf statement.
24.
What is the output of the below program?
What is value of C.
{a=10;
b=12;
c=a+b*2;}
Correct Answer
C. 34
Explanation
The given program calculates the value of the variable "c" using the following formula: c = a + b * 2.
a is assigned the value 10, and b is assigned the value 12.
Now, let's calculate the value of c: c = 10 + 12 * 2 c = 10 + 24 c = 34
So, the value of C is 34.
25.
What will be the output of the following program?
#include<stdio.h>
int main()
{
int arr[3]= {1, 2, 3, 4};
printf("%d\n",arr[3] );
}
Correct Answer
D. 4
Explanation
The program declares an integer array `arr` with a size of 3. However, when initializing the array, it provides four elements instead of three. This will result in a compilation error because the size of the array is exceeded. Therefore, the correct answer is "Compiler Error".
26.
What will be the output of the following program?
int main()
{
int i=1;
do{
printf("%d\t",i);
i++;
if(i > 5)
break;
}
while(TRUE);
return 0;
}
Correct Answer
A. 1 2 3 4 5
Explanation
The program starts by initializing the variable i to 1. It then enters a do-while loop, which means that the code inside the loop will always execute at least once. Inside the loop, the value of i is printed using the printf function. Then, i is incremented by 1. If the value of i is greater than 5, the loop is terminated using the break statement. Since i is incremented after each iteration, the loop will eventually terminate when i becomes 6. Therefore, the output of the program will be 1 2 3 4 5.
27.
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IndiaBIX");
}
return 0;
}
Correct Answer
D. 11 times
Explanation
In this code, the variable x is initially set to -1. The for loop runs as long as x is less than or equal to 10. Inside the loop, the if condition checks if x is less than 5. If it is, the continue statement is executed, which skips the rest of the code inside the loop and goes to the next iteration. If x is not less than 5, the else statement is executed, which includes the break statement. The break statement terminates the loop and exits it completely. Therefore, the code inside the loop that prints "IndiaBIX" is never executed. Since the loop runs 11 times (from -1 to 10), the answer is 11 times.
28.
What is output of following program ?
main( )
{int x;
x= 14 % 8;
printf(“%d”,x);
}
Correct Answer
A. 6
Explanation
The program calculates the remainder of 14 divided by 8 using the modulus operator (%). The remainder is 6. The program then uses the printf function to print the value of x, which is 6. Therefore, the output of the program is 6.
29.
int main()
{
int i=-3, j=2, k=0, m;
m=i++;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}
Correct Answer
D. -3,2,0,-1
Explanation
The correct answer is -3, 2, 0, -1. In the given code, the value of i is initially -3. The statement "m=i++;" assigns the current value of i to m and then increments the value of i by 1. Therefore, m is assigned the value -3 and i becomes -2. The printf statement then prints the values of i, j, k, and m, which are -2, 2, 0, and -3 respectively.
30.
What is output of the following program?
main( )
{int x=15,y=6;
if(x <15)
printf(“%d”,y);
}
Correct Answer
C. 6
Explanation
The program starts by declaring two variables, x and y, with values 15 and 6 respectively. The if statement checks if x is less than 15, which is not true in this case. Therefore, the code inside the if statement is not executed. Since there are no other statements after the if statement, the program does not produce any output. Therefore, the correct answer is 6.
31.
What is the size of long double variable
Correct Answer
B. 8 bytes
Explanation
The size of a long double variable is 8 bytes.
32.
If a is float variable, a=5/2 will return a value
Correct Answer
A. 2.5
Explanation
When dividing two integers, the result is always an integer. In this case, 5 divided by 2 equals 2. However, since the variable "a" is declared as a float, the result will be automatically converted to a float value. Therefore, the correct answer is 2.5.
33.
main( )
{ float a=5; float b=10,c;
c=b%a;
printf(“%f”,c); }output is
Correct Answer(s)
C. 0.00
D. 0.000000
Explanation
The output of the code is 0.00 and 0.000000 because the modulus operator (%) is used to calculate the remainder when dividing two numbers. In this case, b (10) is divided by a (5), which gives a remainder of 0. Since both a and b are floating-point numbers, the result is also a floating-point number. The output is displayed as "0.00" and "0.000000" because the printf statement is used to format and display the result.
34.
Int x=1,y=5;
x=++x + –y;
what is the value of x
Correct Answer
B. -3
Explanation
In the given code:
x is initially set to 1.
y is initially set to 5.
Now, let's break down the expression step by step:
++x is a pre-increment operation, which means x is incremented by 1 before its value is used. So, ++x becomes 2.
-y is a negation of y, so -y becomes -5.
Now, we add 2 (from ++x) to -5 (from -y):
x = 2 + (-5)
x = 2 - 5
x = -3
So, the value of x is -3.
35.
Which one do you like?
Correct Answer
A. Option 1