1.
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 refer to mistakes in the code's structure or grammar, such as missing semicolons, incorrect variable declarations, or using incorrect syntax for loops or conditionals. These errors prevent the code from being compiled and executed successfully. Therefore, syntax errors are checked and identified during the compilation process.
2.
The purpose of main function is
Correct Answer
D. To start program execution
Explanation
The main function in a program is the entry point where the program execution begins. It is the first function that is called when the program starts running. Therefore, the purpose of the main function is to start the execution of the program.
3.
What is the valid identifier in the following
Correct Answer
D. Q1234
Explanation
The valid identifier in the given options is "q1234". This is because a valid identifier in programming should start with a letter or an underscore, and can be followed by any combination of letters, digits, or underscores. "q1234" follows this rule as it starts with a letter and is followed by a combination of letters and digits. The other options "1fdasgf", "@hgd12", and "fahs%*" do not follow the rule for valid identifiers as they either start with a digit, contain special characters, or have invalid characters.
4.
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 is because char is a 8-bit data type in Java, which means it can store values ranging from -128 to 127.
5.
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, no temporary variable is needed. This can be achieved by using the XOR operation. By XORing the two variables, their values will be swapped without the need for any additional temporary variable. Therefore, the correct answer is 0.
6.
What is output of following program ?
main( )
{int x;
x= 4 + 2 % 8;
printf(“%d”,x);
}
Correct Answer
A. 6
Explanation
The program calculates the value of x using the expression 4 + 2 % 8. The % operator is the modulus operator, which returns the remainder of a division operation. In this case, 2 divided by 8 has a remainder of 2. So, the expression becomes 4 + 2, which equals 6. The program then prints the value of x, which is 6.
7.
When && operator is used with two conditions, conditions need to be satisfied for the expression to be true.
Correct Answer
D. Both
Explanation
The correct answer is "both" because when the && operator is used with two conditions, both conditions need to be satisfied for the expression to be true.
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 is performed before addition and multiplication. Therefore, the expression will be evaluated by dividing 6.6 by a before any other operations are performed.
9.
What is the output of printf(“%d”,printf(“tim”));
Correct Answer
D. Tim3
Explanation
The output of the inner printf statement "tim" is 3 because it consists of three characters. This value is then passed as an argument to the outer printf statement, which uses the "%d" format specifier to print the value as an integer. Therefore, the output of the entire statement is "tim3".
10.
What is output of the following program?
main( )
{int x=15,y;
y=(x >5)? 3 : 4;
printf(“%d”,y);
}
Correct Answer
C. 3
Explanation
The program initializes the variable x with a value of 15. It then assigns the value of 3 to the variable y based on the condition (x > 5). Since 15 is indeed greater than 5, the condition evaluates to true and y is assigned the value of 3. Therefore, the output of the program is 3.
11.
What symbol is used to represent the connector
Correct Answer
C. Circle
Explanation
The symbol used to represent the connector is a circle. This symbol is commonly used in flowcharts and diagrams to indicate a connection or relationship between different elements or processes. The circle represents a point of interaction or communication between components, and it is often used to illustrate the flow of information or the transfer of data.
12.
Bitwise operators cannot be performed on
Correct Answer
A. Float
Explanation
Bitwise operators are used to perform operations on individual bits of a binary representation of a number. However, float data type is a floating-point number which uses a different representation (IEEE 754 standard) and does not have a binary representation that can be manipulated using bitwise operators. Therefore, bitwise operators cannot be performed on float data type.
13.
The ANSI C standard recognizes maximum length of a variable up to
Correct Answer
C. 31 characters
Explanation
The ANSI C standard recognizes a maximum length of a variable up to 31 characters. This means that the name of a variable in C can be up to 31 characters long. This limit is set by the standard to ensure compatibility and consistency across different C compilers and platforms. It is important to adhere to this limit when naming variables in C programs to avoid any potential issues or errors.
14.
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 predefined meanings and cannot be used as variable names.
15.
What is the size of long double variable
Correct Answer
A. 10 bytes
Explanation
The size of a long double variable is 10 bytes.
16.
Variables are initialized in C, using
Correct Answer
C. =
Explanation
In C, variables are initialized using the = operator. The = operator is used for assignment, where the value on the right side of the operator is assigned to the variable on the left side. This allows the variable to hold a specific value that can be used later in the program.
17.
If a is float variable, a=5/2 will return a value
Correct Answer
C. 2.0
Explanation
When performing division with integers in most programming languages, the result will be an integer value. In this case, 5 divided by 2 is equal to 2. However, since the variable "a" is declared as a float, the result of the division will be automatically converted to a float value. Therefore, the correct answer is 2.0.
18.
Int a=13,b=7,c;
c=a&b what is the value of c
Correct Answer
A. 0000 0000 0000 0101
Explanation
The value of c is 0000 0000 0000 0101. This is because the bitwise AND operation (&) is being performed between the binary representations of a and b. In this case, a is 0000 0000 0000 1101 and b is 0000 0000 0000 0111. When the bitwise AND operation is performed, each corresponding bit is compared. If both bits are 1, the result is 1. Otherwise, the result is 0. In this case, the result is 0000 0000 0000 0101, as only the third and first bits are 1 in both numbers.
19.
In the following, which is bitwise operator?
Correct Answer
C. |
Explanation
The correct answer is |. The vertical bar symbol (|) is the bitwise OR operator in programming. It performs a bitwise OR operation on each corresponding bit of two operands, resulting in a new value where each bit is set if either of the corresponding bits in the original operands is set.
20.
If y is of integer type variable then the two expressions.
3*(y-8)/9 and (y-8)/9*3 yield the same value if
Correct Answer
D. Y-8 is an integer multiple of 9
Explanation
If y is an integer multiple of 9, then (y-8) will also be an integer multiple of 9. Therefore, both expressions 3*(y-8)/9 and (y-8)/9*3 will yield the same value.
21.
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 program first assigns the value of 1/2 to the integer variable 'a', which results in integer division and truncates the decimal part, so 'a' becomes 0. Then, it assigns the value of 1.0/2.0 to the float variable 'b', which performs floating-point division and gives the correct decimal value of 0.5. Finally, the program prints the values of 'a' and 'b' using the printf function. Therefore, the output of the program is "a=0 b=0.5".
22.
Representing various steps in a flow diagram is called as
Correct Answer
B. Flow chart
Explanation
The correct answer is flow chart. A flow chart is a visual representation of a process or system, where each step is represented by a symbol or shape and connected by arrows to show the flow and sequence of the steps. It is commonly used to illustrate complex processes, algorithms, or decision-making processes in a clear and organized manner.
23.
C is a
Correct Answer
C. High level language with some low level features
Explanation
The correct answer is "High level language with some low level features." This means that language C is primarily a high-level language, which allows for abstraction and easier programming, but it also includes some low-level features that allow for direct manipulation of hardware and memory. This combination of high-level and low-level features makes C a versatile language that can be used for a wide range of applications, from system programming to application development.
24.
What are the smallest individual units in a program
Correct Answer
D. Tokens
Explanation
Tokens are the smallest individual units in a program. They are the building blocks of a program and represent the smallest meaningful units of code. Tokens can include keywords, identifiers, operators, constants, and symbols. Each token serves a specific purpose in the program and contributes to its overall functionality. By breaking down the program into tokens, it becomes easier for the compiler or interpreter to understand and execute the code.
25.
Which of the following is an empty data type.
Correct Answer
D. Void
Explanation
The correct answer is void. Void is a data type in programming that represents the absence of a value. It is often used as a return type for functions that do not return a value. Unlike other data types like integer, float, and character, void does not hold any data or have any memory allocation. It is essentially an empty data type.
26.
The operator ++ is called as operator
Correct Answer
B. Increment
Explanation
The operator ++ is referred to as the increment operator. This operator is used to increase the value of a variable by 1. It is commonly used in loops and other programming constructs where the value of a variable needs to be incremented. Therefore, the correct answer is "increment".
27.
Which of the following is not a relational operator
Correct Answer
B. &&
Explanation
The given answer, "&&", is not a relational operator. Relational operators are used to compare two values and return a boolean result. The operator "&&" is actually a logical operator, specifically the logical AND operator, which is used to combine two boolean expressions and return true only if both expressions are true. Relational operators include "!=" (not equal to) and ">" (greater than), which compare the values of two operands and return a boolean result based on the comparison.
28.
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
The code starts by initializing the variable m to 5. Then, the variable y is assigned the value of m after it is incremented by 1 using the pre-increment operator (++m). Finally, the values of m and y are printed using the printf function. Since m is incremented before it is assigned to y, both m and y will have the value of 6. Therefore, the output will be 6,6.
29.
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 an integer by another integer in programming, the result is also an integer. In this case, 25 divided by 2 equals 12 with a remainder of 1. Since the result is an integer, the remainder is ignored and the value of C is 12.
30.
Consider scanf(“%2d”, &n); and the input data is 3142 then n will be assigned
Correct Answer
B. 31
Explanation
The correct answer is 31 because the format specifier "%2d" in scanf will only read the first two digits from the input data. In this case, the first two digits are 31, so n will be assigned the value 31.
31.
Pseudo code is
Correct Answer
A. Language independent code
Explanation
Pseudo code is a language independent code that is used to represent algorithms in a simplified manner. It is not tied to any specific programming language and is used to outline the logic of a program without getting into the details of syntax and implementation. Pseudo code helps in understanding and communicating the algorithmic steps of a program, making it easier to translate into any programming language. Therefore, the correct answer is "language independent code".
32.
A block is enclosed with pair of
Correct Answer
B. { }
Explanation
The correct answer is "{ }" because the given options represent different types of brackets used in programming languages. The curly brackets "{ }" are commonly used to enclose a block of code or to define a set or dictionary in programming. The other options, parentheses "( )", and square brackets "[ ]", have different uses in programming, such as for function calls or indexing arrays.
33.
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 a specific meaning and functionality. They are used to define the syntax and structure of the language, and therefore cannot be used as variable names or identifiers in a program.
34.
Size of (double) returns
Correct Answer
B. 8
Explanation
The size of (double) returns 8. In most programming languages, the double data type is used to represent floating-point numbers with double precision. This means that it can store values with a larger range and more decimal places compared to the float data type. The size of a double is typically 8 bytes, which allows it to store 64 bits of information. Therefore, the correct answer is 8.
35.
Which of the following statements is wrong
Correct Answer
C. 3+a=b;
Explanation
The statement "3+a=b;" is wrong because in programming, the equal sign (=) is used for assignment, not for comparison. Therefore, the correct syntax should be "b = 3 + a;".
36.
Main( )
{ int a=5; float b=10,c;
c=b%a;printf(“%f”,c); }output is
Correct Answer
A. Gives an error
Explanation
The code gives an error because the modulus operator (%) cannot be used with float and integer operands. In this case, the variable 'b' is a float and 'a' is an integer, so trying to calculate the modulus of 'b' and 'a' will result in an error.
37.
Int x=1,y=5;
x=++x + –y;what is the value of x
Correct Answer
D. 7
Explanation
The expression "++x" increments the value of x by 1 before it is used in the expression. The expression "-y" negates the value of y. Therefore, "++x + -y" is equivalent to "2 + (-5)", which equals -3. Thus, the value of x is -3.
38.
The process of repeating a group of statements in an algorithm is known as
Correct Answer
B. Iteration
Explanation
The process of repeating a group of statements in an algorithm is known as iteration. This involves executing a set of instructions multiple times until a certain condition is met. It allows for the efficient execution of repetitive tasks and helps in achieving desired outcomes.
39.
Every executable C program must contain a
Correct Answer
C. Main function
Explanation
Every executable C program must contain a main function. The main function is the entry point of the program, where the program starts its execution. It is mandatory for a C program to have a main function, as it is responsible for executing the statements and functions defined in the program. Without a main function, the program will not be able to run or execute any code.
40.
How many variables of the same type can be initialized at a time with the same value
Correct Answer
D. Any number of variables
Explanation
There is no limit to the number of variables of the same type that can be initialized at a time with the same value. In programming, you can assign a value to as many variables as you need, regardless of the type, as long as they are compatible with the value being assigned. Therefore, any number of variables can be initialized at a time with the same value.