Problem taken from a C++ quiz
-
This isn't the exact question (I can't remember what it was exactly) but this example keeps to the spirit of the problem. There was a series of questions which had subtle bugs in them, which all had to be answered in the following way: Does it compile? If so, does it run without (potentially) crashing? If so, what does it print out?
#include // for cout int main() { int x = 4; int y = 2; int *px = &x; int *py = &y; std::cout << "4 / 2 = " << *px/*py << std::endl; return 0; }
When you think you know the answer, go to http://pastebin.com/f57900ce I actually got this one right.-Gatsby
-
Seems like a good professor.
My current favourite word is: Bacon!
-SK Genius
-
Wow, old post, and one voted too. Obviously people don't agree with me :rolleyes: Oh well, i think they seem like a decent proff. anyway, y'all are entitled to your own opinions.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
-
Wow, old post, and one voted too. Obviously people don't agree with me :rolleyes: Oh well, i think they seem like a decent proff. anyway, y'all are entitled to your own opinions.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
-
This brings up memories from first and second semester programming courses, like this:
int x = 5; int y = 100; int z = 0; int* px = &x; int* py= &y; z = *px**py;
Would this execute properly? If yes, what is the value of z after execution?modified on Wednesday, April 23, 2008 10:14 AM
Stuff like that pisses me off. Might be bad experience, but teachers often feel funny and think they come up with a "good" way of testing the students' knowledge with excessively nested or obscure code. The main reason why it pisses me off is because stuff like that usually never got mentioned before in class. Not even once. Not only that, usually none of the resources mention it either. So the students not only have no reason to ever use something like that, they usually don't even know something like that is even possible. This means they have no idea just what the hell will happen. Thinking it through won't help either because it's not something you can deduct from the stuff you learned, it's only a 50/50 guess whether you get the right answer or not. Might be just my bad experience but I've written too many tests where the larger part was made up of questions like that and the things you really discussed in class and read in the resources made up less than half of it. It was more like guessing the right answers rather than testing the acquired knowledge.