Home Tuitions

Chapter-Data Handling

Important MCQ questions for Class 11 Computer Science Chapter-Data Handling

Get Important MCQ questions for Class 11 Computer Science Chapter-Data Handling with a detailed explanation of all the MCQ questions asked from Chapter-Data Handling prepared by the experts. 

Get Selected MCQ-based questions with solutions for Chapter-Data Handling

MCQ Questions set-1 for chapter-Data Handling class 11 Computer Science 

Computer Science - MCQ on Data Handling

Class XI

Q. 1. Fundamental data types in C++ are

a. same as derived data types.

b. arrays, functions and pointers.

c. float, int, void.

d. unions and enumerations.

Answer:

(c)

Explanation: There are 5 fundamental data types in C++: char, int, float, double and void.

Q. 2. At the lowest level, files are treated as a stream of

a. arrays.

b. bytes .

c. octal numbers.

d. hexadecimal numbers.

Answer:

(b)

Explanation: A byte is a basic unit of measurement of information storage in computer science.

Q. 3. C++ is a general purpose programming language. It is also called as

a. high level language.

b. low level language.

c. middle level language.

d. assembly language.

Answer:

(c)

Explanation: C++ is a middle level language. It has features of a high-level language and low-level language.

Q. 4. The invalid identifier is

a. 35abc.

b. age16.

c. _students.

d. $rules.

Answer:

(a)

Explanation: Identifier 35abc is invalid as it starts with a number. An identifier is a sequence of characters. _ and $ are legal identifiers in c++ but 0,1,2 are not.

Q. 5. Multiple character have data type

a. int.

b. bool.

c. float.

d. char.

Answer:

(d)

Explanation: A character data is always declared with the char data type.

Q. 6. Data type identifies

a. type of data only.

b. type of data & its associated operations for handling it.

c. operations for handling data only.

d. data, operations and memory allocations.

Answer:

(b)

Explanation: A data type is a class, which defines the class members, their properties and the operations, which can be performed on the members. Example int is a class of integers defining arithmetic operations on members.

Q. 7. The invalid form of real constant is

a. –0.00625.

b. 35.66.

c. + 5.0.

d. 15,356.30.

Answer:

(d)

Explanation: The form of a real constant is basic real constant, basic real constant followed by a real exponent, integer constant followed by a real exponent. A real exponent is the letter E, followed by an optionally signed integer constant. Basic real constant is an optional sign, an integer part, a decimal point and a fractional part.

Q. 8. Floating constants are

a. real constant.

b. integer constants.

c. char constant.

d. does not exists.

Answer:

(a)

Explanation: A floating constant has a value part that may be followed by an exponent part and a suffix specifying its type.

Q. 9. A character constant is

a. enclosed in double quotes .

b. enclosed in single quotes.

c. enclosed in brackets.

d. enclosed in parenthesis.

Answer:

(b)

Explanation: Text enclosed in single quotes is treated as character constant. The type of character constant is int. Its value is the ASCII code for the character.

Q. 10. Keywords as normal identifier names

a. can not be used.

b. may/may not be used.

c. can be used.

d. can only be used.

Answer:

(c)

Explanation: Keywords are reserved words. They cannot be used as identifier names. It is illegal in C++.

Q. 11. Operators (==, <=, >= ) used in C++ programs are called as

a. logical operators.

b. relational operators.

c. conditional operators.

d. arithmetic operators.

Answer:

(b)

Explanation: Logical operators are (&&,||,!) , arithmetic operators are (+,-,*,/,%),and conditional operator is (? :).

Q. 12. A recursive function would result in infinite recursion, if the following were left out

a. base case.

b. recursive call.

c. subtraction.

d. local variable declarations.

Answer:

(a)

Explanation: A base case refers to the statements that decide the termination of recursive call. For a function to calculate factorial of a number the base case includes defining the factorial of 0 and 1 initially.

Q. 13. A structure is declared with the keyword

a. structure.

b. struct.

c. define.

d. tag.

Answer:

(b)

Explanation: A structure is declared using keyword struct. Example struct names

{ int class; int rollno; float marks; char grade;};

Q. 14. An array in a structure

a. can have elements of different data type.

b. always has elements of the same data type.

c. will have elements of the same struct type.

d. can also define a structure within it.

Answer:

(b)

Explanation: An array is a collection of elements of same data type.

Q. 15. When, the structure is defined without a tag, then the numbers of variables that can be declared are

a. two.

b. three.

c. many.

d. only one.

Answer:

(d)

Explanation: One variable is declared when the structure is defined without a tag.

MCQ Questions set-2 for chapter-Data Handling class 11 Computer Science 

Q. 16. The data type of an array is known as

a. constant.

b. floating point variable of the array.

c. variable

d. base type of the array.

Answer:

(d)

Explanation: Array is a data structure consisting of a group of elements that are accessed by indexing. Each element of an array has the same data type and the array occupies a contiguous area of storage.

Q. 17. A character array is also known as

a. character string.

b. array.

c. integer.

d. character.

Answer:

(a)

Explanation: A character array is also known as character string.

Q. 18. The correct output of the below code is

#include<iostream.h>

void main()

{ int I=5;

if (I=2){cout<<”hello”;}

else cout<<”this is end”;}

a. print this is end.

b. print hello one time.

c. compiler error.

d. run time error.

Answer:

(b)

Explanation: It will always print hello because we have used assignment operator here, instead of comparison operator.

Q. 19. The header file, which declares basic c++ stream I/O routines, is.

 

a. conio.h

b. iostream.h

c. stdio.h

d. iomanip.h

Ans. b)

Explanation: iostream.h contains 2 files : istream and ostream. These have libraries of code, which we may insert in the program, by using as a reference in the top block.

Q. 20) Vectors in C++ consists of

a. integers.

b. floating point numbers.

c. integers and floating point numbers.

d. characters.

Answer:

(c)

Explanation: Vectors in c++ consists of only integers and floating-point numbers.

Q. 21. Evaluate a+=a++ + ++a, when a=20 initially

a. 64.

b. 61.

c. 42.

d. 41.

Answer:

(a)

Explanation: The post increment operator first prints the value and then increment whereas, the pre increment operator first increments the value then print.

Q. 22. The error in the code below is

main()

{

int i, j;

int *ip;

i=j=ip=0; }

a. pointer cannot be used in assignment statement.

b. ip is a pointer and cannot be used as integer.

c. pointer should not be initialized.

d. pointer can not be equal to zero.

Answer:

(b)

Explanation: A pointer points to the address of a variable. It cannot be used as integers.

Q. 23. The result of following expression

ans-( val<500?150:50) when ans=800 val=700, is

a. 150.

b. 700.

c. 650.

d. 700.

Answer:

(d)

Explanation: According to the precedence of operators, first of all , bracket will be evaluated.

Q. 24. Operators (==, <=, >= ) used in C++ programs are called as

a. logical operators.

b. relational operators.

c. conditional operators.

d. arithmetic operators.

Answer:

(b)

Explanation: Logical operators are (&&,||,!) , arithmetic operators are (+,-,*,/,%),and conditional operator is (? :).

Q. 25. The properties of ‘characters’ used in C++ are that, they are

a. implement dependent.

b. not implement dependent.

c. array independent.

d. structures dependent.

Answer:

(a)

Explanation: Characters are implement dependent. A character represents any letter, digit, special symbols and white spaces.

Q. 26. Implicit conversion in c++ is performed by

a. programmer.

b. compiler.

c. preprocessor.

d. interpreter.

Answer:

(b)

Explanation: There are 2 types of conversions available in c++ : implicit and explicit conversions. Implicit conversions are performed by compilers in those expressions, which have mixed data types.

Q. 27. The function of endl is

a. same as ‘\n’.

b. sends a newline character ‘\n’ and flushes the output buffer.

c. to only flush the output buffer.

d. to send a newline character ‘\n’ but does not flushes the output buffer.

Answer:

(b)

Explanation: Both ‘\n’ and endl manipulator sends a new line character ‘\n’ but endl also flushes the output buffer whereas ‘\n’ does not flushes the output buffer.

Q. 28. A class in C++ is known as empty class if, it

a. has more than a name.

b. has no member functions.

c. is just a name.

d. has no common properties.

Answer:

(c)

Explanation: A empty class has no variable declarations, no functions or methods but the objects of these classes can have non–zero size.

Q. 29. Comments in C ++ start with

a. //

b. {

c. ;

d. *

Answer:

(a)

Explanation: C++ supports two types of comments: // for single line comments and /* */ style for commenting out a block of code.

Q. 30. A proper declaration of pointer is

a. int x;

b. int &x;

c. ptr x;

d. int *x;

Answer:

(d)

Explanation: In order to define pointer variables, the programmer must use the operator denoted as * in C++. The symbol * when placed before a pointer variable means, that it is a pointer to.

 

Q.31. The C++ statement to display the memory address of a variable is

a. *a;

b. a;

c. &a;

d. address(a);

Answer:

(c)

Explanation: The operator & is used to find the address, associated with a variable. The syntax of the reference operator is as follows: &variablename.

Q. 32. The C++ statement a& denotes

a. address of a.

b. reference operator.

c. pointer.

d. the scanning the value of a.

Answer:

(b)

Explanation: The programmer must note that, the address operator placed before a variable is not the same as operator & placed after the variable. For example, &x is not same as x&. Variable &x refers to address operator whereas, x& refer to reference operator &.

Q. 33. The C++ statement that, gives the value stored in pointer a is

a. a;

b. val(a);

c. *a;

d. &a;

Answer:

(c)

Explanation: * is value at address operator. Thus, it displays the value pointed by pointer a.

Q. 34. The keyword used to allocate memory is

a. new().

b. malloc().

c. create().

d. value().

Answer:

(a)

Explanation: The new keyword allocates memory for an object, or array of objects of type-name from the free store and returns a suitably typed, nonzero pointer to the object.

Q. 35. The proper keyword, to deallocate memory is

a. free.

b. delete.

c. clear.

d. remove.

Answer:

(b)

Explanation: The delete operator deallocates a block of memory. The argument must be a pointer to a block of memory previously allocated for an object, created with the new operator. The delete operator has a result of type void and therefore, does not return a value.

Q. 36. Procedural language paradigm gives more emphasis on

a. data, rather than the work performed on it.

b. doing things, rather than on data itself.

c. objects and classes.

d. principles of data hiding, abstraction and encapsulation.

Answer:

(b)

Explanation: Procedural programming aims at procedures. It is a list of instructions telling a computer, step by step, what to do, usually having a linear order of execution, from the first statement to the second.

Q. 37. Unary operator, used in C++ programs require

a. two operands.

b. no operand.

c. one operand.

d. any number of operands.

Answer:

(c)

Explanation: C++ provides two unary arithmetic operators-unary plus and unary minus. Unary operators operate on only one operand, which could be a constant or a variable.

Q. 38. The statement i++; is equivalent to

a. i=i+1.

b. i=i-1.

c. i=i+i.

d. i=i+0.

Answer:

(a)

Explanation: i++ is equal to i+1. ++ is an increment operator which, increments value by 1.

Q. 39. The correct statement according to the code below is

struct aditi {

union {

int i;

char ch[2];

} ;

};

a. this would give an error as no union name defined.

b. nesting union within struct is not allowed.

c. this is correct and legal in C++.

d. this is correct and legal in C and C++.

Answer:

(c)

Explanation: This is legal in C++ but not in C. Unions, which do not have a class name, they are anonymous union.

Q. 40. The correct statement according to the code below is

void *a;

char *b;

a=b;

b=a;

a. this is correct.

b. it would give an error as ‘a’ cannot be assigned to ‘b’.

c. it would give an error as ‘b’ cannot be assigned to ‘a’.

d. error in statement 3 and 4.

Answer:

(b)

Explanation: In C++, void pointer cannot be assigned to the pointer of any type. This would give an error of type mismatch. It can be made true when, we explicitly typecast it, b=(char*) a;

Q. 41. The program design method we learned, in order to write object-oriented programs is

a. declare-define-use.

b. public functions and private variables.

c. top down programming.

d. bottom up programming.

Answer:

(d)

Explanation: Object oriented systems use bottom up approach. It uses concept of objects and classes.

Q. 42. Every function in c++ has its code

a. within square brackets.

b. within angular bracket.

c. within curly braces.

d. no bracket used etc .

Answer:

(b)

Explanation : Every function in c++ has its code within curly braces {}

Q. 43. ‘\n’ which is used in C++, is an

a. escape sequence for start.

b. escape sequence for end.

c. escape sequence for null.

d. escape sequence for new line.

Answer:

(d)

Explanation: \’n’ is an escape sequence for new line. It sends the new line character, but does not flush the output buffer.

Q. 44. Program element ‘OxFE’ is an

a. integer.

b. character constant.

c. hexadecimal integer constant.

d. integer constant.

Answer:

(d)

Explanation: Invariant program elements are called "literals" or "constants." The terms "literal" and "constant" are used interchangeably here. OxFE is an integer constant.

Q. 45. The statement which is valid or legal in C++ is

a. A reference can be used without proper initialization.

b. Array of references is legal in c++.

c. Char, int pointers can refer to null pointers but null pointers cannot refer to other pointers.

d. Array of pointers is not legal in c++.

Answer:

(c)

Explanation: A reference has to be properly initialized, otherwise it will result in an error. In C++ , special care is taken for assignment of void pointers to other pointer types. While, we can assign a pointer of any type to a void pointer but, the reverse is not true until, we do explicit typecasting.

Q. 46. The statement which is valid or legal in C++ is

a. An identifier can start with the “_”.

b. An identifier can begin with a digit.

c. All special characters are allowed in c++ identifiers.

d. Single character constants have type char.

Answer:

(a)

Explanation: Identifiers can start with _, but not digits. Identifier is an arbitrarily long sequence of letters and digits. Upper and lower case are different. Single character constants have type int.s

Q. 47. The data type of an array is known as

a. constant.

b. floating point variable of the array.

c. variable

d. base type of the array.

Answer:

(d)

Explanation: Array is a data structure consisting of a group of elements, that are accessed by indexing. Each element of an array has the same data type .