Tuesday, March 4, 2014

5. STRUCTURED DATA TYPE ARRAY


1. Which of the following is a de rived data type that can hold several values of the same type in C++?

(a) Function (b) Pointer (c) Array (d) Reference

2. The collection of variable s of the same type that are referenced by a common name is

(a) Structure (b) Function 
(c) Pointer (d) Array

3. The size of the array should always be

(a) Positive (b) Negative 
(c) Float (d) Double

4. How many type s of arrays are there in C++?

(a) 5 (b) 3 
(c) 2 (d) 4

5. The process of arranging the data in an order in a given array is called

(a) Sorting (b) Filtering (c) Merging (d) Searching

6. Which are treated as single dimensional array of characters?

(a) Literals (b) Integers (c) Floats (d) Characters

7. A character array should be terminated with a symbol

(a) /0 (b) \x (c) 0 (d) \0

8. Which is the member function of standard input stream?

(a) puts( ) (b) gets( ) (c) read( ) (d) getline( )

9 .Which is the member function of standard output stream?

(a) write( ) (b) cin (c) getline( ) (d) gets( )

10. How many parameters are re qui red for write ( ) function?

(a) 3 (b) 2 (c) 5 (d) 4

11. In which header file, string manipulators are defined?

(a) string.h (b) ctype.h (c) conio.h (d) iostream.h

12. Which string function copies source string to target string?

(a) strlen( ) (b) strcmp( ) (c) strcopy( ) (d) strcpy( )

13. Which string function returns the number of characters stored in an array?

(a) strcmp( ) (b) strlen( ) (c) strlength( ) (d) strcpy( )

14. Which array is stored in sequential memory blocks?

(a) 1-D (b) 4-D (c) 3-D (d) 2-D

15. In which type of arrays, matrices can be represented?

(a) 1D-arrays (b) 2D-arrays (c) 4D-arrays (d) 3D-arrays

16. An array of strings is a character array of the type

(a) 4-D (b) 3-D (c) 2-D (d) 1-D

17. Which array is an array in which each element is itself an array?

(a) 1-D (b) Literal (c) 2-D (d) String

18. The array subscripts always commences from

(a) 0 (b) any one number (c) 1 (d) 2

19. The memory required for the integer array num_array[5]; is

(a) 5 bytes (b) 4 bytes (c) 10 bytes (d) 15 bytes

20. The second index of the 2-D array refers to

(a) Column (b) Length (c) Size (d) Row

21 An integer array with indexes from 0 t o 4, all having value 1 may be declared and initialized as

(a) int x[4] = {1}; (b) int x[4] = {1,1,1,1}; (c) int x[ ] = { }; (d) int x[5] = {1,1,1,1,1};

22. To treat spaces as part of string literal, one has to use

(a) getline( ) (b) gets( ) (c) gets( ) or getline( ) (d) puts( )

23 Which member function treats white space or carriage return as terminator for string?

(a) getline( ) (b) gets( ) (c) cin (d) cout

24. The function strcpy(s1, s2)

(a) Appends s2 to end of s1 (b) Copies s1 to s2

(c) Appends s1 to end of s2 (d) Copies s2 to s1

25. What will be output of the following snippet?
char s1[ 3]=”exam”;
char s2[ 3]=”exam”;
st rcmp(s1,s2);

(a) 0 (b) >0 (c) error (d) <0

26 What will be the size of the array float num[4] [6];?

(a) 10 bytes (b) 96 bytes (c) 48 bytes (d) 24 bytes

27 How many number of element scan be stored in the array int sales[2][4]; ?

(a) 7 (b) 6 (c) 8 (d) 16

28. Deter mine the number of elements in the following array declaration int array[10][12];

(a) 480 (b) 240 (c) 120 (d) 22

29. Determine the number of elements in the following array declaration int x[ ][2]={0,1,1,2,2,3};

(a) 2 (b) can't determine (c) 6 (d) 3

30. short fine [ 'A']['E']; declares a two dimensional array with number of rows and columns of

(a) 26, 30 (b) 65, 69 (c) 1,5 (d) 97, 101

31. Arrays in C++ belong to which of the following data type?

(a) Primitive (b) Derived (c) Basic (d) User defined

32. In a 2-D array, the first sub-script stands for

(a) column (b) diagonal (c) object (d) row

33. Which of the following is a 2-dimensional character array?

(a) Array of strings (b) Literals (c) Matrix (d) Strings

34. Which of the following is an invalid array declaration?

(a) int array[]; (b) const int i=10; int array[i];

(c) Both int array[]; and int array[i]; (d) int array[i];

35. Which of the following functions compares the two given strings?

(a) cmpstr() (b) strcpy() 
(c) cpystr() (d) strcmp()

36. Strings are otherwise called as

(a) characters (b) literals 
(c) names (d) constants

37. write() is a member function

(a) All of these three choices 
(b) string.h (c) istream.h (d) ostream.h

38. Memory allotted for int num[2][4]; is

(a) 16 bytes (b) 10 bytes (c) 120 bytes (d) 60 bytes

39. Array parameter by de fault behaves like which parameter?

(a) Reference (b) Variable (c) Constant (d) Value

40. In the array, int sales[2][4]; the first row and second column is

(a) sales[1][2] (b) sales[2][1] (c) sales[0][1] (d) sales[1][0]

No comments:

Post a Comment