You are on page 1of 10

Question: 1

In C++, a function contained within a class is called


(A) a method
(B) a class function
(C) member function
(D) none of these

Ans: C
member function
Question: 2
The && and || operators compare two
(A) boolean values
(B) boolean value
(C) numeric values
(D) numeric value

Ans; B
boolean value
Question: 3
A pointer is
(A) address of a variable
(B) a variable for sorting address
(C) data type of an address variable
(D) indication of the variable to be accessed next

Ans: B
a variable for sorting address
Question: 4
The function abort() is declared in the header file
(A) <math.h>
(B) <iostream.h>
(C) <stdio.h>
(D) <stdlib.h>

Ans: B
<iostream.h>
Question: 5
In C++, when accessing a structure member, the identifier to the left of the dot operator is the name of
(A) structure tag
(B) structure member
(C) structure variable
(D) keyword struck

Ans: C
structure variable

Question: 6
How many values can be returned from a function?
(A) 1
(B) 2
(C) 3
(D) 4

Ans: A
1
Question: 7
A pointer is
(A) data type of an address variable
(B) a variable for storing address
(C) indication of the variable to be accessed next
(D) address of a variable

Ans: B
a variable for storing address
Question: 8
A relational operator
(A) assigns operand to another
(B) yields a Boolean result
(C) logically combines two operands
(D) compares two operands

Ans: D
compares two operands
Question: 9
In C++, a function contained within a class is called
(A) a method
(B) a class function
(C) member function
(D) none of these

Ans: C
member function
Question: 10
An array element is accessed using
(A) member name
(B) an index number
(C) dot operator
(D) a first in first out approach

Ans: B
an index number
Question: 11
The function that allows a file to read randomly is
(A) frandon()
(B) rewind()
(C) ftell()
(D) fseek()

Ans: D
fseek()
Question: 12
Which of the following is not a control statement in C language?
(A) goto statement
(B) switch statement
(C) for statement
(D) repeat until statement

Ans: D
repeat until statement
Question: 13
Which of the following modifier is used to declare a variable as constant?
(A) const
(B) signed
(C) short
(D) unsigned

Ans: A
const
Question: 14
Which of the following string functions reverse the string?
(A) strrev()
(B) strcmp()
(C) strlen()
(D) strcpy()

Ans: A
strrev()
Question: 15
Operand of indirection operator is
(A) ordinary variable
(B) integer constant
(C) pointer variable
(D) none of above

Ans: C
1) Choose a correct statement.
int a = 12 + 3 * 5 / 4 - 10
A) 12, 3, 5, 4 and 10 are Operators.  +, -, * and / are Operands.  = is an increment operator.
B) 12, 3, 5, 4 and 10 are Operands.  +, -, * and / are Operators.  = is decrement operator.
C) 12, 3, 5, 4 and 10 are Operands.  +, -, * and / are Operators.  = is an assignment operator.
D) 12, 3, 5, 4 and 10 are Operands.  +, -, * and / are Logical Operators.  = is an assignment operator.
Answer [C]
2) Operator % in C Language is called.?
A) Percentage Operator
B) Quotient Operator
C) Modulus
D) Division
Answer [C]

3) Output of an arithmetic expression with integers and real numbers is ___ by default.?
A) Integer
B) Real number
C) Depends on the numbers used in the expression.
D) None of the above
Answer [B]
4) Choose a right statement.
int a = 10 + 4.867;
A) a = 10
B) a = 14.867
C) a = 14
D) compiler error.
Answer [C]
5) Choose a right statement.
int a = 3.5 + 4.5;
A) a = 0
B) a = 7
C) a = 8
D) a = 8.0
Answer [C]
6) Choose a right statement.
float var = 3.5 + 4.5;
A) var = 8.0
B) var = 8
C) var = 7
D) var = 0.0
Answer [A]
7) Choose right statement.
int main()
{
float c = 3.5 + 4.5;
printf("%f", c);

return 0;
}
A) 8.0
B) 8.000000
C) 8
D) 7
Answer [B]

8) Choose a right statement.


int main()
{
float c = 3.5 + 4.5;
printf("%d", (int)c);

return 0;
}
A) 8.0
B) 8.000000
C) 7
D) 8
Answer [D]
9) Choose a right statement.
int a = 5/2;
int b = 5.0/2;
int c = 5 / 2.0;
int d = 5.0/2.0;
A) a = 2, b = 2, c = 2, d= 2
B) a = 2, b = 2.0, c = 2, d= 2.0
C) a = 2, b = 2.5, c = 2.5, d= 2.5
D) a = 2.5, b = 2.5, c = 2.5, d= 2.5
Answer [A]
10) Choose a right statement.
float a = 5/2;
float b = 5/2.0;
float c = 5.0/2;
float d = 5.0/2.0;
A) a=2.5, b=2.5, c=2.5, d=2.5
B) a=2, b=2.5, c=2.5, d=2.5
C) a=2.0, b=2.5, c=2.5, d=2.5
D) a=2.0, b=2.0, c=2.0, d=2.0
Answer [C]
11) If both numerator and denominator of a division operation in C language are integers, then we get.?
A) Expected algebraic real value
B) Unexpected integer value
C) Compiler error.
D) None of the above
Answer [B]
12) Choose a right statement.
int var = 3.5;
A) a = 3.5
B) a = 3
C) a = 0
D) Compiler error
Answer [B]
13) Choose a right statement.
int main()
{
int var = 3.5;;
printf("%f", var);

return 0;
}
A) 3.500000
B) 3
C) 3.5
D) 0.000000
Answer [D]
14) What is the output of the program.?
int main()
{
int a = 25%10;
printf("%d", a);

return 0;
}
A) 2.5
B) 2
C) 5
D) Compiler error.
Answer [C]

You might also like