Multiplle choice circle only one answer 2 point each 1) An application of the ST
ID: 3726583 • Letter: M
Question
Multiplle choice circle only one answer 2 point each 1) An application of the STACK is a) Files stored in folders and subfolders b) Internet web browser stores recently visited sites, we return to most recently visited first c) TCP/IP packets being checked as they come into port. 2) To write the definition of a function template we specify type with a) templatecint I> b) int(template int) c) template d) template 3) To change the size of a vector named vec, use a) vec.change size(5) b) vec.resize(5) c) vec.scale(5) d) vec.align(5). e) vector can't be resized. 4) In an array named arr of size 5, if we coutExplanation / Answer
1) Application of Stack
Ans. b) Internet web pages stores recently visited sites, return the most recently visited first
Explanation: Stack is data structure in which we stores items as last in fisrt out (LIFO). So when we store the recently visited pages in stack the one which is just visited will be at the top and when we have to acess it will the first to pop out.
2) To rewrite defination of template we specify type with
Ans a) template <int I> b) template <typename T>
Explanation: Here both are correct, template os usage of generic programming. In defining its prototypes we can use either keywords i.e. class or typename
3) To change the size of vector
Ans b) vec.resize(5)
Explanation:As in vector its size automatically gets adjusted as many items got pushed in it. But in case we want to extend the size of it externally above is the syntax and if size is increased than the new enteries are initialized to 0 by default.
4)In an vec array of size 5 if we cout<<vec[10]
Ans b) THe contents of the location in RAM that would be arr[10]
Explanation: It is purely compiler specific it acess the memory and no error will ocur, but its behavoiur is purely un predictable. It can either acess the previously written value or anything, wvwn it can print nothing.
5)In a vector named vec of size 5 if we cout<<vec[10] this would give
Ans b) the contents of RAM that would be vec[10] if vec were if size 11 or greater.
Explanation: Vectors works as if like array but its uppewr limit is not defined so it work as array only so it can also print anything.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.