Object Oriented Programming (OOPs) MCQs > FREE SET - 3

1. Which of the following is an access specifier?
A particular
B shielded
C protected
D safe

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

2. Machine code is __________
A edited code
B source code
C the 0s and 1s that the computer can understand
D None of the above

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

3. The contents of two pointers that point to adjacent of type float differ by
A one bytes
B two bytes
C three bytes
D four bytes

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

4. Which of the following is a valid condition for if statement?
A (age) > 65
B (age > 0 and < 10)
C (sales > 500 && < 800)
D (sales > 100 && sales <= 1000)

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

5. A pattern for creating an object is called a(n) _________
A class
B attributes
C private
D public

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

6. An asterisk in C++ placed after a data type means
A array to
B pointer to
C address to
D located to

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

7. An object is a(n) _________ of a class.
A owner
B function
C definition
D instance

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

8. Which of the following statements creates and initializes a pointer named salesPtr?
A float *salesPtr = NULL;
B *salesPtr = "";
C float &salesPtr = NULL;
D float *salesPtr = "";

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

9. With communicational cohesion
A a tasks and the data are related
B the tasks are related; the data are not
C the data are related; the tasks are not
D the tasks and the data are unrelated

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

10. The function printDataMembers() is most likely a(n) __________.
A inspector functions
B mutator functions
C auxiliary functions
D manager functions

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

11. Which of the following formulas can be used to generate random integers between 1 and 10?
A 1 + rand() % (10 - 1 + 1)
B 1 + (10 - 1 + 1) % rand()
C 10 + rand() % (10 - 1 + 1)
D 10 + rand() % (10 + 1)

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

12. Format flags may be combined using the __________.
A bitwise OR operator(|)
B logical OR operator (||)
C bitwise AND operator (&)
D logical AND operator (&&)

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

13. If a class will serve as a base class, most often the base class data members are
A private
B protected
C public
D polymorphic

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

14. You can use the C++ _________ function to assign a value to a String variable
A assign
B strcopy
C string
D strcpy

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

15. A measure of the strength of the connection between two functions is
A cohesion
B coupling
C dependence
D subjection

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

16. The following statement where T is true and F is false T&&T||F&&T
A is true
B is false
C is wrong
D None of the above

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

17. Which of the following statements declares a variable that can contain a decimal number?
A dec payRate;
B dec hourlyPay
C float payRate
D float hourlyPay;

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

18. The statement int num[2][3]={ {1,2}, {3,4}, {5, 6} };
A assigns a value 2 to num[1][2]
B assigns a value 4 to num[1][2]
C gives an error message
D assigns a value 3 to num[1][2]

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

19. The standard input stream in C++, which refers to the keyboard, is called
A cin
B cout
C stin
D stout

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

20. Access specifiers in C++ are followed by
A a comma
B a semicolon
C a colon
D two colons

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

21. Elements in an array are identified by a unique __________.
A data type
B order
C subscript
D symbol

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

22. To include the double quotes as part of the control string we use the symbol
A %"
B ""
C \\"
D None of the above

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

23. A C++ statement must end with a
A : (column)
B , (commA)
C . (peri
D D) ; (semicolon)

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

24. Student senior(); is a(n)_________.
A constructor call with no arguments
B object instantiation
C constructor call with all default arguments
D prototype for a function that returns a student object

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

25. The statement int n[4] = {11, -13, 17, 105};
A assigns the value -13 to [2]
B assigns the value 17 to n[2]
C is wrong; it gives an error message
D assigns the value 18 to n[2]

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

26. To use the strcpy function, you must include the ________ header file in your C++ program.
A assign.h
B strcpy.h
C string.h
D strcopy.h

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

27. The number of the relational operators in the C language is
A four
B six
C three
D one

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

28. Which of the following tells C++ to display numbers with two decimal places?
A setdecimal(2)
B setiosflags(2)
C setiosflags(2.00)
D setprecision(2)

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

29. We can output text to an object of class ofstream using the insertion operator
A the ofstream class is a stream
B the insertion operator works with all classes
C we are actually outputting to cout
D the insertion operator is overloaded in ofstream

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

30. The operator that allocates new memory is __________.
A allocate
B mem
C new
D next

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

31. A comment
A is a note that can be put into the source code
B is ignored by the compiler.
C starts with the /* character pair
D All of the above

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

32. Which of the following is valid identifier in C++?
A record_1
B 1 record
C return
D $tax

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

33. The functions go in the ___________ section of a class definition.
A declaration
B implementation
C prototype
D functioning

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

34. You can throw in C++___________.
A a scalar variable
B a constant
C a programmer-defined class object
D any of these

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

35. You invoke a function with a
A function call
B function declaration
C function definition
D function prototype

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

36. Reserving memory during program execution is known as reserving it
A dynamically
B statically
C functionally
D powerfully

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

37. A programming structure that contains data and a pointer to the next object is a
A template
B class
C pointer class
D linked list

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

38. A variable declared in a function is called a(n) _____ variable.
A area
B global
C local
D reference

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

39. When you write to a file rather than the screen, you use the C++ class __________.
A iostream
B filed
C fstream
D diskclass

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

40. To use this pointer with a member function, you _________.
A declare this as static
B declare this as global
C define this as equal to the address of the appropriate object
D do nothing; it is automatically supplied for you

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

41. A function that is prototype as int calculate(int num); may
A receive an integer variable named num from the main() program
B receive any integer variable from the main() program
C either (A) or (B)
D neither (A) nor (B)

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

42. A do-while loop contains
A only one statement between the do statement and the while statement
B several statements between the do statement and the while statement
C no statement at all between the do statement and the while statement
D only two statement between the do statement and the while statement

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

43. The braces that surround the code in a 'C program
A show what code goes in a particular function
B delimit a section of code
C separate the codes from the constant
D separate the source file from the subject file

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

44. The indirection operator is the
A asterisk
B ampersand
C dollar sign
D plus sign

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

45. Local variables _________.
A are created outside a block
B are known only to that block
C continue to exist when their block ends
D are illegal in C++

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

46. # directives must be present
A before the main() function
B after the main() function
C at the end of the program
D anywhere in the program body

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

47. Programmers prefer to declare almost all variables __________.
A at the beginning of each function
B globally
C on one line
D with cryptic names

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

48. The C++ _________ function generates random numbers.
A generate()
B genRand
C rand
D srand

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

49. You have declared an integer pointer called point, you have also declared an integer called number. Which statement is the correct format?
A point = number;
B point = *number;
C point = &number;
D point = +number;

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

50. If you wanted to sort many large objects or structures, it would be most efficient to
A place them in an array and sort the array
B place pointers to them in an array and sort the array
C place them in a linked list and sort the linked list
D place references to them in an array and sort the array

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.


No comments:

Post a Comment

Your Feedback is hearty Requested to make the MCQs Collection better.

Popular Posts