26. Which of the following is a valid expression that returns the number of elem
ID: 3902274 • Letter: 2
Question
26. Which of the following is a valid expression that returns the number of elements in a vector
A) sizeof(v)
B) v.length()
C) v.size()
D) v.count()
27. When integer literals are used as arguments, almost all of the common mathematical functions return a value of type:
A) int
B) float
C) double
D) long double
28. What is the name of the function that raises a number to a power?
A) exp
B) pow
C) raise
D) x^y
29. Which of the following is a valid operator that performs stream insertion?
A) <<
B) <-
C) >>
D) ->
30. Which of the following is a valid operator that performs stream extraction?
A) <<
B) <-
C) >>
D) ->
31. Which of the following is a valid expression that erases all elements from a vector named v?
A) v.reset()
B) v.erase_all()
C) v.empty()
D) v.clear()
32. Which of the following is a valid expression that returns the first element of a vector named v?
A) v.begin()
B) v.first()
C) v.front()
D) v[1]
33. Which of the following is a valid expression that returns the last element of a vector named v?
A) v.last()
B) v.back()
C) v.end()
D) v[v.size()]
34. What is the name of the function that reads a line from an input stream?
A) readline
B) readln
C) getline
D) getln
35. The rand function never returns a value...
A) Less than 0
B) Less than or equal to 0
C) Less than 1
D) Less than or equal to 1
36. The string type represents:
A) A sequence of bits
B) A sequence of bytes
C) A sequence of characters
D) A sequence of integers
37. One valid set of arguments to string::erase is:
A) A starting index and an index past the last element to erase
B) A starting index and an index at the last element to erase
C) A starting index and the number of elements that should remain after the operation
D) A starting index and the number of elements to erase
38. What is the name of the function that can convert an integer into a string?
A) itos
B) itoa
C) int_to_string
D) to_string
39. What is the name of the function that can convert a string to an integer?
A) stoi
B) atoi
C) string_to_int
D) to_int
40. Assuming c is a variable of type char, which of the following is a valid expression that extracts the next character, including whitespace, from cin and assigns it to c?
A) cin >> c
B) cin.get(c)
C) cin.getc(c)
D) cin.getchar(c)
41. Assuming s is a variable of type string, which of the following is a valid expression that extracts the next word (non-whitespace characters) from cin and assigns it to s?
A) cin >> s
B) cin.getw(s)
C) cin.getword(s)
D) cin.gets(s)
42. If cin is associated with the keyboard, what key combination signals the end of all further user input without necessarily terminating the program?
A) CTRL-C
B) CTRL-D
C) CTRL-Z
D) CTRL-
43. What does assert do?
A) Aborts the program if the given expression is false
B) Aborts the program if the given expression is true
C) Exits the program if the given expression is false
D) Exits the program if the given expression is true
44. What is the name of the function that exchanges the values between two variables of the same type?
A) switch
B) xchg
C) swap
D) exchange
45. The expression time(0) returns a value that represents the current time in...
A) Microseconds
B) Nanoseconds
C) Milliseconds
D) Seconds
Its a study guide but i would really like somehting to have for refrence.
Explanation / Answer
Answer 26: C
Answer 27: A
Answer 28: B
Answer 29: A
Answer 30: C
Answer 31: D
Answer 32: C
Answer 33: B
Answer 34: C
Answer 35: A
Answer 36: C
Answer 37: D
Answer 38: D
Answer 39: A
Answer 40: B
Answer 41: A
Answer 42: A
Answer 43: A
Answer 44: C
Answer 45: D
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.