Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

43. If you are reading a text file using the ifstream object, how do you tell if you have reached the end of the file?

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
43. If you are reading a text file using the ifstream object, how do you tell if you have reached the end of the file? 44. If you open a text file for reading using the ifstream object, how do you tell if the open was successful? 45. Write a function prototype for a function named add that accepts two arguments of type int and double and returns a value of type double. 46. If a program calls a function with a reference argument and the function alters the argument, is the value in the caller affected? For example: the function: int incr (int& n) { n += 1; return n; } the caller of the function: int k = 3; int j = incx (k) ; 47. Can a c++ function call itself? Yes or no. 48. In the function prototype void action (int& value) ; The argument value is said to be a parameter. 49. In the previous problem, suppose the function action updated its argument. True or false: the variable value in the caller would be updated. 50. True or false: the following two prototypes represent valid overloaded functions double fna (double,inc.) ; float fna (float.int) ; 51. True or false: the following two prototypes represent valid overloaded functions int fob (string, int.) ; float fnb (string,int.) ; 52. What is wrong with this function definition? void area (int length=30 int width) return length * width; 53. True or false: Bounds checking (check for out-of-range indices) is performed for arrays.68. Write the definition of a structure named Item that contains three fields, a string named desc, an int named quantity, and a double named price. 69. Write the definition of a function make Item that takes arguments string d, int q, and double p and returns an Item with desc=d, quantity=q, and price=d.54. True or false: Bounds checking (check for out-of-range indices) is performed for vectors 55. True or false: The size of an array is fixed when declared and cannot be changed. 56. True or false: The size of a vector is fixed when declared and cannot be changed. 57. To copy an array you must 58. When an array name, without a subscript, is an argument of a function call, what is passed to the function? 59. Why is the binary search algorithm more efficient than the sequential search algorithm for arrays with a large size? 60. In order to use a binary search algorithm, what pre-condition must be true for the array being searched? 61. Why is the bubble sort inefficient for large arrays?62. Given the code: int a [12] ; int *ap = a; suppose the memory address of a is 1000. What memory location will ap+2 point to? 63. True or false. Pointers can be compared for equality but not for greater than or less than. 64. In the expression int * const ptr; which is constant, the integer that ptr is pointing to or the value of the ptr itself? 65. Array names can be used as and vice versa. 66. What character testing function from can be used to determine if a given character is either a letter or a number? 67. What include file is needed to create a map template class?82. Write a class definition for a class named Fraction that contains two integer fields named numerator and denominator. Include in the class a prototype for a method (function) named add that takes two Fraction objects as input arguments and returns a Fraction object as output. You do not need to provide an implementation of the add method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

=+ 11. What is the inflation tax?

Answered: 1 week ago