1.
An algorithm is best described as:
Correct Answer
B. A step by step procedure for solving a problem
Explanation
An algorithm is a set of instructions or a step-by-step procedure that is used to solve a problem or perform a specific task. It is not a computer language, as it can be implemented in various programming languages. While it may involve mathematical concepts or be used in mathematical calculations, it is not solely a branch of mathematics. Therefore, the correct answer is that an algorithm is a step-by-step procedure for solving a problem.
2.
Which of the following is related to machine language?
Correct Answer
D. All of the above
Explanation
All of the options mentioned are related to machine language. Machine language is difficult to learn as it consists of low-level instructions that are specific to a particular computer architecture. It is also considered a first-generation language as it was the first type of programming language used to communicate with computers. Additionally, machine language is machine-dependent, meaning it is designed for a specific computer system and cannot be executed on other machines without modification. Therefore, all of the given options are correct in relation to machine language.
3.
Product of matrices A(m x n) and B(n x p) will be matrix C with row and column as:
Correct Answer
A. M and p
Explanation
The product of matrices A(m x n) and B(n x p) will result in a matrix C with m rows and p columns. This is because the number of rows in matrix A must match the number of columns in matrix B in order for the multiplication to be defined. The resulting matrix C will have the same number of rows as matrix A and the same number of columns as matrix B, which is m and p respectively.
4.
The operator && in 'C' language is a
Correct Answer
C. AND operator
Explanation
The operator && in 'C' language is the AND operator. This operator is used to combine two conditions and returns true only if both conditions are true. If either of the conditions is false, the result will be false. Therefore, the correct answer is AND operator.
5.
If A=5 and B=++A, the value of A and B
Correct Answer
A. 6,6
Explanation
When A=5 and B=++A, the value of A is incremented by 1 before assigning it to B. Therefore, the value of A becomes 6 and B is also assigned the value of 6. Hence, the correct answer is 6,6.
6.
Choose the odd one out
Correct Answer
D. A=+1
Explanation
The given options a=a+1, a+=1, and a++ all increment the value of 'a' by 1. However, a=+1 is different because it assigns the value of +1 to 'a' instead of incrementing its current value.
7.
The expression, i=30*10+27; evaluates to:
Correct Answer
A. 327
Explanation
The expression i=30*10+27 evaluates to 327. This is because the multiplication operation is performed first, resulting in 300. Then, the addition operation is performed, adding 27 to 300, resulting in the final value of 327.
8.
BCPL
Correct Answer
C. Basic Combined Programming Language
Explanation
BCPL stands for Basic Combined Programming Language. It is a programming language that was developed in the 1960s and was widely used for system programming. BCPL is considered a low-level language because it provides low-level control over the computer's hardware and memory. It is not an assembly language, which is a type of low-level language that is specific to a particular computer architecture. Therefore, the correct answer is "Basic Combined Programming Language."
9.
Choose the odd one out
Correct Answer
C. While
Explanation
The given options consist of different control structures used in programming. "while" is the odd one out because it is the only option that is a looping construct, while the others are conditional statements or decision-making constructs. "if" is used for making a decision based on a condition, "if-else" is used for making a decision with two possible outcomes, and "switch-case" is used for making a decision with multiple possible outcomes. "while" is used for repeating a block of code until a certain condition is met.
10.
While(1) { }
Correct Answer
A. Valid
Explanation
The given code snippet is a while loop with a condition of "1", which means the loop will continue indefinitely. This is a valid construct in many programming languages, including C, C++, and Java. The loop body is empty, but it is still considered valid code.
11.
Break used
Correct Answer
C. Forces the statement to come out
Explanation
The correct answer "Forces the statement to come out" explains that the use of the "break" keyword in programming is used to exit a loop or switch statement prematurely. When the "break" statement is encountered, the program will immediately exit the loop or switch statement and continue executing the next line of code after the loop or switch. This allows for conditional termination of a loop or skipping the remaining cases in a switch statement.
12.
For(; ;)
Correct Answer
B. Valid
Explanation
The given code snippet is a for loop with no initialization, condition, or increment statement. This means that the loop will run indefinitely, as there is no condition to stop it. Therefore, the statement "valid" is correct, as the code will continue to execute without terminating.
13.
Int a[3]={1,2,3}; printf("%d",a[3]);
Correct Answer
C. 0
Explanation
The given code initializes an array "a" with 3 elements {1, 2, 3}. However, when trying to print the value at index 3 (a[3]), it is accessing a memory location beyond the size of the array. This results in undefined behavior. In this case, it prints the value 0, which is likely the value stored in the memory location immediately after the array.
14.
The string is terminated automatically in the memory
Correct Answer
A. By NULL
Explanation
In programming, strings are typically stored as arrays of characters. In order to indicate the end of a string, a special character called NULL is used. When a string is terminated by NULL, it means that the last character of the string is followed by a NULL character, which serves as a marker to indicate the end of the string. This allows programs to know where the string ends and prevents any unexpected behavior when manipulating or accessing the string. Therefore, the correct answer is "By NULL".
15.
Matrix is
Correct Answer
B. Combination of row and column
Explanation
A matrix is a combination of rows and columns. It is a two-dimensional array that is arranged in a rectangular form, where each element is identified by its row and column index. The rows represent the horizontal dimension, while the columns represent the vertical dimension. Therefore, a matrix is not just a one-dimensional array, but rather a structure that combines both rows and columns to organize and represent data.
16.
Which of the following is the correct order of evaluation for the below expression
z=x+y*z/4%2-1
Correct Answer
A. */%+-=
Explanation
The correct order of evaluation for the expression "z=x+y*z/4%2-1" is as follows: first, the multiplication ( * ) and division ( / ) operations are performed from left to right, then the modulo ( % ) operation is performed, followed by the addition ( + ) and subtraction ( - ) operations. Finally, the result is assigned to the variable z ( = ).
17.
Which of the following is the correct order if calling a function in the below code?
a= f1(23,14)* f2 (12/4) +f3();
Correct Answer
A. F1,f2,f3
Explanation
The correct order of calling the functions in the given code is f1, f2, f3. This is because the function f1 is called with the arguments 23 and 14, then the function f2 is called with the result of the division operation 12/4, and finally the function f3 is called without any arguments.
18.
How many times "IndiaBIX" is get printed
int main()
{
int x;
for (x=-1;x<=10;x++)
{
if(x<5)
continue;
else break;
printf("IndiaBix");
}
return 0;
}
Correct Answer
B. 0 times
Explanation
The loop starts with x=-1 and continues until x
19.
What do the following declaration signify? void *cmp();
Correct Answer
C. Cmp is a function that return a void pointer
Explanation
The declaration "void *cmp();" signifies that cmp is a function that returns a void pointer. The return type of the function is void *, indicating that the function will return a pointer to an unspecified type.
20.
When the following piece of code is executed, what output will be generated?
#include<stdio.h>
int main()
{
char arr[7]="Network";
printf("%s",arr);
return 0;
}
Correct Answer
C. Garbage value
Explanation
When the code is executed, it will print the string "Network" because the character array "arr" is initialized with the string "Network". The printf statement will print the string using the "%s" format specifier. There will not be any garbage value printed in this case.
21.
The result of Relational operation is always
Correct Answer
A. Either true or false
Explanation
The result of a relational operation is always either true or false because relational operations compare two values and determine whether they satisfy a specific relationship, such as less than, greater than, or equal to. The comparison can only have two outcomes: either the relationship is true or it is false. Therefore, the correct answer is "Either true or false."
22.
The keyword used to transfer control from a function back to the calling function is
Correct Answer
D. Return
Explanation
The keyword "return" is used to transfer control from a function back to the calling function. When a function is called, the program execution moves to that function and starts executing the statements inside it. The "return" keyword is used to exit the function and return the control back to the calling function. It can also be used to return a value from the function to the calling function.
23.
What is the similarity between a structure, union and enumeration?
Correct Answer
B. All of them let you define new data types
Explanation
All of the options mentioned in the question (structure, union, and enumeration) allow the programmer to define new data types. These data types can be used to create variables and store values of different types in memory. By defining new data types, it becomes easier to organize and manipulate data in a program, increasing code readability and maintainability.
24.
Which of the following cannot be used as identifiers?
Correct Answer
C. Digits
Explanation
Digits cannot be used as identifiers because identifiers in programming languages are typically used to represent variables, functions, or other entities, and they must follow certain rules. One of these rules is that an identifier cannot start with a digit. It can only start with a letter or an underscore. However, digits can be used within an identifier after the first character.
25.
How many times is a do while loop guaranteed to loop
Correct Answer
A. 0
Explanation
A do-while loop is guaranteed to loop at least once because the condition is checked at the end of the loop. However, if the condition is false after the first iteration, the loop will not execute again. Therefore, the correct answer is 0, indicating that the loop may not execute more than once.
26.
In the passage of text, individual words and punctuation marks are known as
Correct Answer
B. Keywords
Explanation
In the passage of text, individual words and punctuation marks are known as keywords. Keywords are specific words or phrases that have a predefined meaning in a programming language. They are used to define the structure and behavior of the program. Examples of keywords in programming languages include "if," "else," "for," "while," and "return." These keywords cannot be used as variable names or identifiers because they have a special meaning in the language.
27.
Which of the following are not valid variable names in C?
Correct Answer
D. All of the above
Explanation
All of the options mentioned are not valid variable names in C. In C, variable names cannot contain special characters or spaces. The option "float_int" violates this rule by having an underscore between two words. "keyword" is not a valid variable name as it is a reserved keyword in C. "A1" is a valid variable name as it starts with a letter and can contain letters, numbers, and underscores. The options "ANSI", "ASCII", and "CPU" are not valid variable names as they consist entirely of capital letters, which is not allowed in C. Therefore, the correct answer is "All of the above".
28.
When we declare an array
Correct Answer
A. Compiler declare array name itself as a constant pointer to base address
Explanation
When we declare an array, the compiler automatically declares the array name itself as a constant pointer to the base address. This means that the array name represents the memory address of the first element in the array. Additionally, a continuous block of memory is allocated to store the values of the elements in the array. The index of the elements is declared automatically, allowing us to access specific elements using their index values. Finally, when the array is declared, all the elements are initialized to zero by default.
29.
The C statements printf (" The value= %x",62); will print
Correct Answer
D. The value=3C
Explanation
The printf statement with the format specifier "%x" will print the hexadecimal representation of the number 62. In hexadecimal, the number 62 is represented as "3C". Therefore, the correct answer is "The value=3C".
30.
Macros are defined using
Correct Answer
A. #define
Explanation
Macros in programming are defined using the #define directive. This directive allows programmers to create symbolic names or constants that can be used throughout the code. The #define directive is used to define a macro and associate it with a specific value or code snippet. This allows for easier code maintenance and readability, as the macro can be used instead of writing the value or code snippet repeatedly.
31.
Which of the following datatype is a structured data type with heterogeneous elements
Correct Answer
B. Structure
Explanation
A structure is a datatype that allows us to combine different types of variables into a single entity. It is considered a structured data type because it can contain heterogeneous elements, meaning it can store variables of different data types within it. This allows for the organization and grouping of related data, making it easier to manage and access. In contrast, an array is a data structure that stores elements of the same data type, an enum is an enumerated type that represents a set of named values, and a pointer is a variable that stores the memory address of another variable.
32.
The default return type of main() is
Correct Answer
A. Int
Explanation
The default return type of the main() function in C++ is int. This means that the main() function is expected to return an integer value to the operating system when the program terminates.
33.
In C program, all variable must be declared before they are used
Correct Answer
A. True
Explanation
In C programming, all variables must be declared before they are used. This means that the programmer needs to specify the type and name of the variable before using it in any statements or calculations. This is necessary because the compiler needs to know the data type of the variable in order to allocate memory for it and perform appropriate operations. If a variable is used without being declared first, the compiler will generate an error. Therefore, the statement "all variable must be declared before they are used" is true in C programming.
34.
The file stdin has to be explicitly opened before it can be used
Correct Answer
B. False
Explanation
The statement is false because the file stdin does not need to be explicitly opened before it can be used. In most programming languages, stdin is a pre-defined file that is automatically open for reading. It is used to read input from the user or from another source. Therefore, there is no need to explicitly open it before using it.
35.
Array is a collection of:
Correct Answer
A. Identical data objects
Explanation
An array is a collection of identical data objects because it is a data structure that stores elements of the same type in contiguous memory locations. Each element in an array is accessed by its index, and all elements have the same data type. Therefore, an array is used to store a collection of identical data objects.
36.
When multidimensional array are assigned initial value:
Correct Answer
A. Rightmost subscript increases most rapidly
Explanation
When multidimensional arrays are assigned an initial value, the rightmost subscript increases most rapidly. This means that when filling the array with values, the rightmost index changes more frequently than the other indices. For example, in a 2D array, the column index changes more rapidly than the row index. This is important to understand when accessing and manipulating elements in a multidimensional array.
37.
If you don't initialize a static array, what will be the elements set to?
Correct Answer
A. Zero
Explanation
When a static array is not initialized, the elements are automatically set to zero. This means that each element in the array will have a value of zero until it is explicitly assigned a different value.
38.
The exit() function causes an exit from a function
Correct Answer
B. False
Explanation
The exit() function causes an exit from the entire program, not just a function. When the exit() function is called, the program terminates immediately and any remaining code in the function or program is not executed. Therefore, the statement "The exit() function causes an exit from a function" is false.
39.
Which option is used to print question mark
Correct Answer
A. \0
Explanation
The correct answer is \?. The backslash (\) is used as an escape character in programming languages, and when followed by certain characters, it represents a special character. In this case, the question mark (?) is a special character that needs to be printed as a regular character, so it is preceded by a backslash to indicate that it should be treated as a literal question mark. The option \0 is incorrect because it represents the null character, and \\ represents a single backslash.
40.
Choose the Correct one:
p=5/2
Correct Answer
A. 1
Explanation
The correct answer is 1 because the given equation p=5/2 simplifies to p=2.5. Since 2.5 is not one of the options, the closest option to 2.5 is 2, but it is still not equal to 2.5. Therefore, the correct answer is 1, which is the closest whole number to 2.5.