Sie sind auf Seite 1von 10

Answers

C & C++ Aptitude Questions

1. C++ was originally developed by a) Nicolas Wirth b) Donald Knuth c)Bjarne Stroustrup d)Ken Thompson

2. The standard c++ comment a) / b)// c)/* and */ d) None of these

3. The preprocessor directive #include is required if a) Console output is used b)Console input is used c) Both console input and output is used d) None of these

. The operator << is called a) an insertion operator b) put to operator c) either a or b d) None of these

5. The operator >> is called a)an extraction operator b)a get from operator c)either a or b d) get to operator

6. When a language has the capability to produce new data type, it is called a) Extensible b) Overloaded c) Encapsulated d)Reprehensible

Answers

7. The C++ symbol << a)perform the action of sending the value of expression listed as its right to the outputs strewn as the left. B) is used to indicate the action from right to left c) is adopted to resemble an arrow d)All the above

8. C++ name was suggested by a)Rrick Mascitti b) Bjarne Stroustrup c)Donald Knuth d) Ken Thompson

9. What is a reference? a) an operator b)a reference is an alias for an object c)used to rename an object d) None of these

10. A constructor is called whenever a) a object is declared b)an object is used c)a class is declared d)a class is used

11. State the object oriented languages a) C++ b) Java c)Eiffel d)All of the above 12. Overload function in C++ a) a group function with the same name b)all have the same number and type of arguments c) functions with same name and same number and type of arguments d) All of the above

13. Operator overloading is

Answers

a) making c++ operators works with objects b) giving new meaning to existing c++ operators c)making new c++ operator d)both a& b above

14. A constructor is called whenever a)a object is declared b)an object is used c)a class is declared d)a class is used

15. A class having no name a)is not allowed b)can't have a constructor c)can't have a destructor d)can't be passed as an argument

16. The differences between constructors and destructor are a) constructors can take arguments but destructor can't b) constructors can be overloaded but destructors can't be overloaded c)both a & b d)None of these

17. A destructor takes a)one argument b) two arguments c)three arguments d) Zero arguments

18. Constructors are used to a)initialize the objects b) construct the data members c) both a & b d) None of these

19. In C++ a function contained with in a class is called a) a member function b) an operator c) a class function d) a method

Answers

20. The fields in a class of a c++ program are by default a) protected b) public c) private d)None of these

21. The meaning of conversion character for data input is a) Data item is a long integer b) Data item is an unsigned decimal integer c)Data item is a short integer d) None of the above

22. The conversion characters for data input means that the data item is a) An unsigned decimal integer b)A short integer c)A hexadecimal integer d)A string followed by white space

23. An expression contains relational, assignment and arithmetic operators. If Parenthesis are not present, the order will be a) Assignment, arithmetic, relational b)Relational, arithmetic, assignment c) Assignment, relational, arithmetic d)Arithmetic, relational, assignment

24. Which of the following is a key word is used for a storage class a) printf b)external c)auto d)scanf

25. In the C language 'a represents a)a digit b)an integer c)a character d)a word

26. The number of the relational operators in the C language is

Answers

a) Four b) Six c)Three d) One

27. A compound statement is a group of statements included between a pair of a)double quote b)curly braces c)parenthesis d)a pair of /s

28. A Link is a) a compiler b)an active debugger c) a C interpreter d) a analyzing tool in C

29. The continue command cannot be used with a)for b) switch c)do d)while

30. In C, a Union is a)memory location b) memory store c) memory screen d)None of these

31. When the main function is called, it is called with the arguments a) argc b) argv c) None of these c)both a & b

32. A multidimensional array can be expressed in terms of a)array of pointers rather than as pointers to a group of contiguous array b)array without the group of contiguous array c) data type arrays d)None of these

Answers

33. C allows arrays of greater than two dimensions, who will determined this a)programmer b)compiler c) parameter d) None of these

34. A pointer to a pointer in a form of a)multiple indirection b)a chain of pointers c) both a and b d)None of these

35. Pointers are of a)integer data type b)character data type c) unsigned integer data types d)None of these

36. Maximum number of elements in the array declaration int a[5][8] is a) 28 b)32 c)35 d)40

37. If the size of the array is less than the number of initializers then, a)Extra values are being ignored b) Generates an error message c)Size of Array is increased d)Size is neglected when values are given

38. Array subscripts in C always start at a)-1 b)1 c) 0 d)Value provided by user

39. A Structure a) cannot be read as a single entity b)can be displayed as a single entity c) has member variables d)that cannot be read individually

Answers

40. Identify the invalid pointer arithmetic a)Addition of float value to a pointer b) Comparision of pointers that do not point to the element of the same array c)Subtracting an integer from a pointer d) Assigning the value 0 to a pointer variable 41. Which of the following statements is true? a)C Library functions provide I/O facilities b)C inherent I/O facilities c)C doesnt have I/O facilities d)Both (a) and (c)

42. Header files in C contain a) Compiler commands b) Library functions c)Header information of C programs d)Operators for files

43. Which pair of functions below are used for single character I/O. a)Getchar() and putchar() b) Scanf() and printf() c)Input() and output() d) None of these

44. The printf() function retunes which value when an error occurs? a)Positive value b) Zero c)Negative value d) None of these

45. Identify the wrong statement a) putchar(65) b)putchar('x') c)putchar("x") d)putchar('\n')

Answers

46. Which of the following is charecter oriented console I/O function? a) getchar() and putchar() b)gets() and puts() c) scanf() and printf() d)fgets() and fputs()

47. The output of printf("%u", -1) is A) -1 b)minimum int value c)maxium int value d) Error message

48. An Ampersand before the name of a variable denotes a) Actual Value b) Variable Name c) Address d)Data Type

49. Symbolic constants can be defined using a) # define b)const c)symbols d)None of these

50. Null character is represented by a) \n b) \0 c) \o d)\e

51. Which header file is essential for using strcmp() function? a)string.h b)strings.h c)text.h d)strcmp.h

52. malloc() function used in dynamic allocation is available in which header file? a)stdio.h b)stdlib.h c)conio.h d) mem.h

Answers

53. File manipulation functions in C are available in which header file? a)streams.h b) stdio.h c) stdlib.h d)files.h

54. C supports how many basic looping constructs a) 2 b) 3 c) 4 d)6

55. A statement differs from expression by terminating with a a) ; b) : c) NULL d) .

56. What should be the expression return value for a do-while to terminate A)1 b)0 c)-1 d)NULL

57. Which among the following is a unconditional control structure a)do-while b)if-else c) goto d)for

58. continue statement is used a) to go to the next iteration in a loop b)come out of a loop c)exit and return to the main function d) restarts iterations from beginning of loop

59. Which operator in C is called a ternary operator a) if..then b)++ c) ? d) ()

60. Which of the following header file is required for strcpy() function? a) string.h b)strings.h c)files.h d) strcpy()

Back

ANSWER
1.c 2.b 3.c 4.c 5.c 41.d 42.b 43.a 44.c 45.c

:
6.a 7.d 8.a 9.b 10.a 46.a 47.c 48.c 49.b 50.b 11.d 12.a 13.d 14.a 15.c 16.c 17.d 18.a 19.a 20.c 51.a 52.b 53.b 54.b 55.a 21. c 22. d 23.d 24. c 25. c 56.b 57.c 58.a 59.c 60.a 26.b 27.b 28.d 29. b 30. a 31. d 32. a 33.b 34.c 35.d 36.d 37.b 38.b 39.b 40.a

Das könnte Ihnen auch gefallen