

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Quiz; Class: Data Structures; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Unknown 1989;
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


NetId:
#include
template <class a, int b> void func() { cout << "this is func"; }
int main() { long c = 5; func<int, c> (); }
(a) It will not compile because c is not an int. (b) It will not compile because c is not a constant. (c) It will not compile since main() doesn’t return an integer. (d) It will compile and print “this is func” on the screen.
#include
template
template
int main() { const long c = 5; func
(a) It will not compile since two instances of func() have conflicting signatures. (b) It will not compile since c is a constant. (c) It will compile and print “foo” on the screen. (d) It will compile and print “bar” on the screen.
1: int x = 5; 2: int * const y = &x; 3: int const * z = &x; 4: const int * t = &x;
5: *y = 6; 6: *z = 10; 7: *t = 11;
(a) It has compile error in lines 5 and 6.
(b) It has compile error in lines 6 and 7.
(c) It has compile error in lines 5, 6 and 7.
(d) There is no compile error.