Q1. A precise sequence of steps to solve a problem is called
- A.Statement
- B.Program✓ Correct
- C.Utility
- D.Routine
Q2. The Compiler of C language is written in
- A.Java Language
- B.UNIX
- C.FORTRON Language
- D.C Language✓ Correct
Q3. Initialization of variable at the time of definition is,
- A.Must
- B.Necessary
- C.Good Programming✓ Correct
- D.None of the given options
Q4. In if structure the block of statements is executed only,
- A.When the condition is false
- B.When it contain arithmetic operators
- C.When it contain logical operators
- D.When the condition is true✓ Correct
Q5. Which of the following function(s) is/are included in stdlib.h header file?
- A.double atof(const char *nptr)
- B.int atoi(const char *nptr)
- C.char *strcpy ( char *s1, const char *s2)
- D.1 and 2 only✓ Correct
Q6. Pointer is a variable which store,
- A.Data
- B.Memory Address✓ Correct
- C.Data Type
- D.Values
Q7. Preprocessor program perform its function before ______ phase takes place.
- A.Editing
- B.Linking
- C.Compiling✓ Correct
- D.Loading
Q8. Which of the following can not be a variable name?
- A.area
- B._area
- C.10area✓ Correct
- D.area2
Q9. Which looping process is best, when the number of iterations is known?
- A.for✓ Correct
- B.while
- C.do-while
- D.all looping processes require that the iterations be known
Q10. Which character is inserted at the end of string to indicate the end of string?
- A.new line
- B.tab
- C.null✓ Correct
- D.carriage return
Q11. How many bytes are occupied by declaring following array of characters? char str[] = “programming”;
- A.10
- B.11✓ Correct
- C.12
- D.13
Q12. Which of the following header file defines the rand() function?
- A.iostream.h
- B.conio.h
- C.stdlib.h✓ Correct
- D.stdio.h
Q13. Commenting the code _____________________
- A.Makes a program easy to understand for others.✓ Correct
- B.Make programs heavy, i.e. more space is needed for executable.
- C.Makes it difficult to compile
- D.All of the given options.
Q14. What's wrong with this for loop? for (int k = 2, k <=12, k++)
- A.the increment should always be ++k
- B.the variable must always be the letter i when using a for loop
- C.there should be a semicolon at the end of the statement
- D.the commas should be semicolons✓ Correct
Q15. For which array, the size of the array should be one more than the number of elements in an array?
- A.int
- B.double
- C.float
- D.char✓ Correct
Q16. In C/C++ the string constant is enclosed
- A.In curly braces
- B.In small braces
- C.In single quotes
- D.In double quotes✓ Correct
Q17. The size of int data type is
- A.1 bytes
- B.2 bytes
- C.3 bytes
- D.4 bytes✓ Correct
Q18. In Flow chart process is represented by
- A.Rectangle✓ Correct
- B.Arrow symbol
- C.Oval
- D.Circle
Q19. If the break statement is missed in switch statement then,
- A.The compiler will give error
- B.This may cause a logical error✓ Correct
- C.No effect on program
- D.Program stops its execution
Q20. When we are using const keyword with a variable x then initializing it at the time of declaration is,
- A.Must✓ Correct
- B.Optional
- C.Not necessary
- D.A syntax error
Q21. Which of the following is the correct way to assign an integer value 5 to element of a matrix say ‘m’ at second row and third column?
- A.m[2][3] = 5 ;
- B.m[3][2] = 5 ;
- C.m[1][2] = 5 ;✓ Correct
- D.m[2][3] = ‘5’;
Q22. How many total elements must be in two-dimensional array of 3 rows and 2 columns?
Q23. Which of the following is the correct statement for the following declaration? const int *ptr.
- A.ptr is a constant pointer
- B.ptr is constant integer pointer
- C.ptr is a constant pointer to int
- D.ptr is a pointer to const int✓ Correct
Q24. Consider the following code segment. What will be the output of this code segment? int arr[6] = {2, 3, 7, 4, 5, 6} ; int *ptr1 =&arr[1] ; int *ptr2 = &arr[4] ; cout << (ptr2-ptr1) ;
Q25. What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?
- A.*ptr = arr ;
- B.ptr = arr ;✓ Correct
- C.*ptr = arr[5] ;
- D.ptr = arr[5] ;
Q26. C is a/an ______ language
- A.low level✓ Correct
- B.object based
- C.object oriented
- D.function oriented
Q27. Syntax of union is identical to ______
- A.Structure✓ Correct
- B.Class
- C.Function
- D.None of the given options
Q28. A character is stored in the memory in _________
- A.byte✓ Correct
- B.integer
- C.string
- D.None of the given
Q29. These functions seekg() and seekp() requires an argument of type ____________to let them how many bytes to move forward or backward.
- A.int
- B.short
- C.long✓ Correct
- D.double
Q30. dereferencing operator is represented by _______
- A.*✓ Correct
- B.+
- C.–
- D.None of the given
Q31. ______________ transfers the executable code from main memory to hard disk.
- A.Loader✓ Correct
- B.Debugger
- C.Compiler
- D.Linker
Q32. When the logical operator OR (||) combine two expressions exp1 and exp2 then the result will be false only,
- A.When both exp1 and exp2 are true
- B.When both exp1 and exp2 are false✓ Correct
- C.When exp1 is true and exp2 is false
- D.When exp1 is false and exp2 is true
Q33. suppose we have int y[10]; To access the 4th element of the array we write_________
- A.y[4];
- B.y[3];✓ Correct
- C.y[2];
- D.none of given
Q34. we have opened a file stream myfile for reading (getting), myfile.tellg () gives us the current get position of the file pointer. It returns a whole number of type___________
- A.long✓ Correct
- B.int
- C.short
- D.double
Q35. ofstream is used for________
- A.Input file stream
- B.Output file stream✓ Correct
- C.Input and output file stream
- D.All of the given
Q36. A structure is a collection of _____________under a single name.
- A.values
- B.variables✓ Correct
- C.data
- D.None of the given
Q37. There are mainly -------------------- types of software.
- A.Two
- B.Three✓ Correct
- C.Four
- D.Five
Q38. seekg() and write() are functionally _________________ .
- A.Different✓ Correct
- B.Identical
- C.Two names of same function
- D.None of the above
Q39. When a pointer is incremented, it actually jumps the number of memory addresses
- A.According to data type✓ Correct
- B.1 byte exactly
- C.1 bit exactly
- D.A pointer variable can not be incremented
Q40. In functions that return reference, use __________variables.
- A.Local
- B.Global
- C.Global or static✓ Correct
- D.None of the given option
Q41. The declarator of Plus (+) member operator function is
- A.Class-Name operator + (Class-Name rhs)✓ Correct
- B.operator Class-Name + ( )
- C.operator Class-Name + ( rhs)
- D.Class-Name operator + ( )
Q42. What is the functionality of the following syntax to delete an array of 5 objects named arr allocated using new operator? delete arr ;
- A.Deletes all the objects of array
- B.Deletes one object of array✓ Correct
- C.Do not delete any object
- D.Results into syntax error
Q43. What is the sequence of event(s) when allocating memory using new operator?
- A.Only block of memory is allocated for objects
- B.Only constructor is called for objects
- C.Memory is allocated first before calling constructor✓ Correct
- D.Constructor is called first before allocating memory
Q44. What is the sequence of event(s) when deallocating memory using delete operator?
- A.Only block of memory is deallocated for objects
- B.Only destructor is called for objects
- C.Memory is deallocated first before calling destructor
- D.Destructor is called first before deallocating memory✓ Correct
Q45. A template function must have at least ---------- generic data type
- A.Zero
- B.One✓ Correct
- C.Two
- D.Three
Q46. If we do not mention any return_value_type with a function, it will return an _____ value.
- A.int✓ Correct
- B.char
- C.float
- D.double
Q47. Suppose a program contains an array declared as int arr[100]; what will be the size of array?
- A.0
- B.99
- C.100✓ Correct
- D.101
Q48. Which of the following option is true about new operator to dynamically allocate memory to an object?
- A.The new operator determines the size of an object
- B.Allocates memory to object and returns pointer of valid type
- C.Creates an object and calls the constructor to initialize the object
- D.All of the given options✓ Correct
Q49. new and delete are _____ whereas malloc and free are _____.
- A.Functions, operators
- B.Classes, operators
- C.Operators, functions✓ Correct
- D.Operators, classes
Q50. Like member functions, ______ can also access the private data members of a class.
- A.Non-member functions
- B.Friend functions✓ Correct
- C.Any function outside class
- D.None of the given options
Q51. Which of the following statement is best regarding declaration of friend function?
- A.Friend function must be declared after public keyword.
- B.Friend function must be declared after private keyword.
- C.Friend function must be declared at the top within class definition.
- D.It can be declared anywhere in class as these are not affected by the public and private keywords.✓ Correct
Q52. The operator function overloaded for an Assignment operator (=) must be
- A.Non-member function of class
- B.Member function of class✓ Correct
- C.Friend function of class
- D.None of the given options
Q53. For non-member operator function, object on left side of the operator may be
- A.Object of operator class
- B.Object of different class
- C.Built-in data type
- D.All of the given options✓ Correct
Q54. The operator function will be implemented as _____, if obj1 drive the - operator whereas obj2 is passed as arguments to - operator in the statement given below. obj3 = obj1 - obj2;
- A.Member function✓ Correct
- B.Non-member function
- C.Friend function
- D.None of the given options
Q55. Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
- A.Class-name operator +() ;
- B.Class-name operator +(int) ;
- C.Class-name operator ++() ;✓ Correct
- D.Class-name operator ++(int) ;
Q56. The static data members of a class are initialized _______
- A.at file scope✓ Correct
- B.within class definition
- C.within member function
- D.within main function
Q57. Class is a user defined___________.
- A.data type✓ Correct
- B.memory referee
- C.value
- D.none of the given options.
Q58. Automatic variable are created on ________.
- A.Heap
- B.Free store
- C.static storage
- D.stack✓ Correct
Q59. Compiler is a
- A.System software✓ Correct
- B.Application Software
- C.Driver
- D.Editor
Q60. Operating System is
- A.An application software
- B.System Software✓ Correct
- C.Computer Language
- D.Interpreter
Q61. Which one is the correct syntax for defining an identifier PI with preprocessor directive?
- A.#define PI 3.1415926;
- B.#define PI 3.1415926✓ Correct
- C.#define PI = 3.1415926 ;
- D.#define PI = 3.1415926
Q62. Character strings are arrays of characters that can store
- A.Only one character
- B.Limited number of characters
- C.Number of characters specified.✓ Correct
- D.None of the given option
Q63. Which of the following is NOT a preprocessor directive?
- A.#error
- B.#define
- C.#line
- D.#ndefine✓ Correct
Q64. Which kind of functions can access private member variables of a class?
- A.Friend functions of the class
- B.Private member functions of the class
- C.Public member functions of the class
- D.Friend, private and public functions✓ Correct
Q65. Let suppose int a, b, c, d, e;, a = b = c = d = e = 42; This can be interpreted by the complier as:// assignment is right-associative.
- A.a = (b = (c = (d = (e = 42))));✓ Correct
- B.(a = b = (c = (d = (e = 42))));
- C.a = b = (c = (d = (e = 42)));
- D.(a = b) = (c = d) = (e = 42);
Q66. Friend function of a class is ______________ .
- A.Member function
- B.Non-member function✓ Correct
- C.Private function
- D.Public function
Q67. When we define an array of objects then,
- A.Constructor will be called once for whole array
- B.Constructor will be called for each object of the array✓ Correct
- C.Constructor will never call
- D.Depends on the size of array
Q68. The stream objects cin and cout are included in which header file?
- A.iostream.h✓ Correct
- B.fstream.h
- C.istream.h
- D.ostream.h
Q69. Missing semicolon ‘;’ at the end of C++ statement is
- A.Logical error
- B.Syntax error✓ Correct
- C.Runtime error
- D.None of the given options
Q70. What will be the correct syntax for initialization of pointer ptr of type int with variable x?
- A.int ptr = &x ;
- B.int ptr = x ;
- C.int *ptr = &x ;✓ Correct
- D.int ptr* = &x ;
Q71. Which of the following function calling mechanism is true for the function prototype given below? float func(float &);
- A.Call by value
- B.Call by reference using pointer
- C.Call by reference using reference variable✓ Correct
- D.None of the given options
Q72. If overloaded plus operator is implemented as non-member function then which of the following statement will be true for the statement given below? obj3 = obj1 + obj2 ;
- A.obj2 will be passed as an argument to + operator whereas obj2 will drive the + operator
- B.obj1 will drive the + operator whereas obj2 will be passed as an argument to + operator
- C.Both objects (obj1, obj2) will be passed as arguments to the + operator✓ Correct
- D.Any of the objects (obj1, obj2) can drive the + operator
Q73. Which of the following object(s) will call the member operator function within the statement given below? obj1=obj2+obj3;
- A.Object obj1
- B.Object obj2✓ Correct
- C.Object obj3
- D.Any of the object
Q74. For cin, the source is normally a ________ and destination can be ______.
- A.File, native data type
- B.Disk, user-define type
- C.Keyboard, variable✓ Correct
- D.File, user-define type
Q75. The static data members of a class will be ________
- A.shared by objects✓ Correct
- B.created for each object
- C.initialized within class
- D.initialized within main function
Q76. Which of the following function cannot be overloaded?
- A.Member functions
- B.Utility functions
- C.Constructor
- D.Destructor✓ Correct
Q77. The region of memory, available for allocation at run time in C language is called ________ memory whereas in C++ language is called as ________________.
- A.Heap, Stack
- B.Stack, Free Store
- C.Heap, Free Store✓ Correct
- D.None of above
Q78. A variable which is defined inside a function is called
- A.Automatic variable✓ Correct
- B.Global variable
- C.Functional variable
- D.None of the given option
Q79. The code is written to __________ the program.
- A.implement✓ Correct
- B.design
- C.analysis
- D.none of the given options.
Q80. Analysis is the -------------- step in designing a program.
- A.Last
- B.Middle
- C.Post Design
- D.First✓ Correct
Q81. In C/C++ if we define an array of size eight (8) i.e. int Arr [8]; then the last element of this array will be stored at,
- A.Arr[0]
- B.Arr[8]
- C.Arr[7]✓ Correct
- D.Arr[-1]
Q82. When an array is passed to a function then default way of passing this array is,
- A.By data
- B.By reference✓ Correct
- C.By value
- D.By data type
Q83. Array is a data structure which store
- A.Memory addresses
- B.Variables
- C.Data Type
- D.Data✓ Correct
Q84. Which of the following is correct way to initialize a variable x of int type with value 10?
- A.int x ; x = 10 ;
- B.int x = 10 ;✓ Correct
- C.int x, x = 10;
- D.x = 10 ;
Q85. Default mechanism of function calling in case of array is _____ and in case of variable is ___.
- A.Call by value, call by reference
- B.Call by referene, call by reference
- C.Call by reference, call by value✓ Correct
- D.Call by value, call by value
Q86. What does STL stand for?
- A.Source template library
- B.Standard template library✓ Correct
- C.Stream template library
- D.Standard temporary library
Q87. Skill(s) that is/are needed by programmers _______________________.
- A.Paying attention to detail
- B.Think about the reusability
- C.Think about user interface
- D.All of the given options✓ Correct
Q88. Friend functions are _____ of a class.
- A.Member functions
- B.Public member functions
- C.Private member functions
- D.Non-member functions✓ Correct
Q89. The prototype of friend functions must be written ____ the class and its definition must be written ____
- A.inside, inside the class
- B.inside, outside the class✓ Correct
- C.outside, inside the class
- D.outside, outside the class
Q90. The programs, in which we allocate static memory, run essentially on ________
- A.Heap
- B.System Cache
- C.None of the given options
- D.Stack✓ Correct
Q91. The default value of a parameter can be provided inside the ________________
- A.function prototype✓ Correct
- B.function definition
- C.both function prototype or function definition
- D.none of the given options.
Q92. While calling function, the arguments are assigned to the parameters from _____________.
- A.left to right.✓ Correct
- B.right to left
- C.no specific order is followed
- D.none of the given options.
Q93. When an operator function is defined as member function for a binary Plus (+) operator then the number of argument it take is/are.
- A.Zero
- B.One✓ Correct
- C.Two
- D.N arguments
Q94. With user-defined data type variables (Objects), self assignment can produce __________.
- A.Syntax error
- B.Logical error✓ Correct
- C.Link error
- D.Non of the given options
Q95. When an object of a class is defined inside an other class then,
- A.Constructor of enclosing class will be called first
- B.Constructor of inner object will be called first✓ Correct
- C.Constructor and Destructor will be called simultaneously
- D.None of the given options
Q96. In the member initializer list, the data members are initialized,
- A.From left to right
- B.From right to left
- C.In the order in which they are defined within class✓ Correct
- D.None of the given options
Q97. new operator allocates memory from free store and return _____________.
- A.A pointer✓ Correct
- B.A reference
- C.An integer
- D.A float
Q98. "new" and "delete" keywords are _____________ in C++ language.
- A.Built-in- Function
- B.Operators✓ Correct
- C.Memory Allocation Function
- D.None of the given options
Q99. Consider the following code segment. What will be the output of following code?
- A.6,6,8✓ Correct
- B.6,8,8
- C.6,6,6
- D.6,8,6
Q100. Here the code is given below. You have to identify the problem in the code. while (i < 10) && (i > 24))
- A.the logical operator && cannot be used in a test condition
- B.the while loop is an exit-condition loop
- C.the test condition is always true
- D.the test condition is always false✓ Correct
Q101. The correct syntax of do-while loop is
- A.(condition ) while; do { statements; };
- B.{ statements; } do-while ();
- C.while(condition); do { statements; };
- D.do { statements; } while (condition);✓ Correct
Q102. Matrix is defined as
- A.Multi-dimensional array✓ Correct
- B.Vector product
- C.Scalar product
- D.Single-dimensional array
Q103. Debugger
- A.Editor
- B.Program
- C.Linker✓ Correct
- D.Debugger
Q104. application software
- A.system software✓ Correct
- B.computer language
- C.interpreter
- D.application software
Q105. From the options given, you need to choose the option which is true for the given code. for (int i=1; i>0; i++) { /* loop code */ }
- A.the logical operator && cannot be used in a test condition
- B.the while loop is an exit-condition loop
- C.the test condition is always false
- D.the test condition is always true✓ Correct
Q106. Which of the following values are used in C/C++ to represent true and false?
- A.1 and 0✓ Correct
- B.1 and -1
- C.11 and 00
- D.Any numerical value
Q107. three
- A.zero
- B.two✓ Correct
- C.one
- D.three
Q108. What will be the correct syntax for initialization of a pointer ptr with string "programming"?
- A.char ptr = 'programming';
- B.char *ptr = "programming";✓ Correct
- C.char *ptr = 'programming';
- D.*ptr = "programming";
Q109. in
- A.out
- B.trunc
- C.get
- D.in✓ Correct
Q110. ios::ate
- A.ios::app✓ Correct
- B.ios::binary
- C.ios::edit
- D.ios::ate
Q111. Streams
- A.Fields
- B.Variables
- C.Header files
- D.Streams✓ Correct
Q112. Public
- A.Protected
- B.Private
- C.Public and Private✓ Correct
- D.Public
Q113. The function write() takes as parameter(s)
- A.String of pointer type
- B.String of variable lengths, no. of bytes to be read and flags
- C.Pointer array of characters and a delimiter
- D.String and no. of bytes to be written✓ Correct
Q114. More than
- A.Less than
- B.Exactly
- C.Similar✓ Correct
- D.More than
Q115. When the logical operator AND (&&) combines two expressions exp1 and exp2 then the result will be true only
- A.When both exp1 and exp2 are true✓ Correct
- B.When both exp1 and exp2 are false
- C.When exp1 is true and exp2 is false
- D.When exp1 is false and exp2 is true
Q116. Start
- A.End
- B.Begin✓ Correct
- C.Middle
- D.Start
Q117. In order to get 256 from the number 2568 we divide this number by 10 and take,
- A.Its remainder
- B.The number
- C.Its quotient✓ Correct
- D.Its divisor
Q118. The data type before a function name represents its,
- A.Return Type✓ Correct
- B.Function data
- C.Function arguments
- D.Function name
Q119. Member function tellg() returns the current location of the _____________ pointer.
- A.tellptr()
- B.write()
- C.seekg()
- D.get()✓ Correct
Q120. What does 5 | 6 , evaluate to in decimal where ‘|’ is bitwise OR operator?
Showing the first 120 of 169 MCQs.