Thread Closed

C++ Quiz starts here...>

 
Share Thread Thread Tools
Jan20-07, 08:30 AM   #1
 
Arrow

C++ Quiz starts here...>


Let me start a Quiz based on c++ programming in this thread.
You are requested to give the right answer in quotes;
RULE:
No special rules are there.Anyway,
>>The person who tells the right answer must post the next question,No one must post Q's in between.
The person who answers must post a question,next to Ur answer.

Think and answer....
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> 'Whodunnit' of Irish potato famine solved
>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change
>> Curiosity Mars rover drills second rock target
Jan20-07, 08:31 AM   #2
 
Let me start from easy Q's;

1)C++ programming language was developed at....?
 
Jan20-07, 11:51 AM   #3
 
Bell Labs, and it had been called C with _____....?
 
Jan20-07, 11:53 AM   #4
 

C++ Quiz starts here...>


Classes

Can't come up with anything tougher: Who invented the language?
 
Jan20-07, 11:58 AM   #5
 
Stroustrup (if that is spelled correctly)

The ++ in C++ refers to _____
 
Jan20-07, 02:22 PM   #6
 
++ is shorthand of +=1 which C++ implements.

List the different types of variables that can be called.
 
Jan20-07, 02:33 PM   #7
 
Can be called?

Hmm...
#1: char, short, int, long, _int64
#2: unsigned char, unsigned short, etc
#3: char[], short[], int[], etc
#4: char *, short *, int *, etc
#5: const char *, const short *, etc
#6: char * const, short * const, etc
#7: const char * const, etc
#8: char **, short **, etc
#9: const variations of #8
#10: char[][], etc

I'm not sure if there are variations that mix [] and *, I guess there would be, like (char*)[].

Then:
#11: float, double, long double
#12: float[], double[], etc
etc

Then obviously structs and classes are types. I've probably missed a bunch.

List the bitwise operators of C++.
 
Jan21-07, 06:35 PM   #8
 
You forgot "void *". Even though there can't really be a variable of type void, you can certainly have a pointer to one.

Gotta love C++.
 
Jan21-07, 06:40 PM   #9
 
Quote by verty View Post
List the bitwise operators of C++.
& - and
| - or
^ - xor
~ - not (bitwise)
>> - shift right
<< - shift left

What does the following code fragment do?

(void *(*)(...))
 
Jan21-07, 06:42 PM   #10
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
Retired Staff Staff Emeritus
Don't forget fun types like

int (* (*[10]) (long, void*) ) (const char*, int *[])

!
 
Jan21-07, 07:01 PM   #11
 
Quote by Hurkyl View Post
Don't forget fun types like

int (* (*[10]) (long, void*) ) (const char*, int *[])
A generally malformed question, I think. It was a little too wide open.

Managed to translate my typecast into English, yet?
 
Jan21-07, 08:00 PM   #12
 
void *(*)(...) ...a function pointer to a function that returns some buffer.

[0] What is the main difference between C and C++
[1] What does :1 do in a variable declaration.
 
Feb4-07, 07:31 PM   #13
 
Quote by twisting_edge View Post
What does the following code fragment do?

(void *(*)(...))
It uses C to do a job in C++ when it really it shouldn't be used, it uses the dreaded void pointer and a variable argument list.

Quote by neurocomp2003
[0] What is the main difference between C and C++
[1] What does :1 do in a variable declaration.
0)see neutrino's post.
1)It's a bit field.

What is the only difference between a struct and a class?
 
Feb4-07, 11:05 PM   #14
 
Struct is default public, class is default private.

What's the difference between a virtual destructor and a virtual function?
 
Feb12-07, 05:00 AM   #15
 
Virtual Functions and Destructors

A virtual function is a member function of a class, whose functionality can be over-ridden in its derived classes. It is one that is declared as virtual in the base class using the virtual keyword. The virtual nature is inherited in the subsequent derived classes and the virtual keyword need not be re-stated there. The whole function body can be replaced with a new set of implementation in the derived class

A virtual destructor is one that is declared as virtual in the base class and is used to ensure that destructors are called in the proper order. It is to be remembered that destructors are called in the reverse order of inheritance. If a base class pointer points to a derived class object and we some time later use the delete operator to delete the object, then the derived class destructor is not called.


???CAN U NAME THE SPECIAL FUNCTIONS A C++ COMPILER CAN CREATE IMPLICITY?
 
Feb14-07, 02:13 PM   #16
 
Quote by powergirl View Post
If a base class pointer points to a derived class object and we some time later use the delete operator to delete the object, then the derived class destructor is not called.
This got a bit confusing. When destructing an object, you have to call the correct destructor; the virtual destructor plays the same role as virtual methods. Virtual destructors are useful when deleting the objects through a base pointer (like virtual methods are useful when calling the methods through a base pointer).

So in the end, the difference between virtual destructors and virtual methods is the same between plain destructors and plain methods.


Quote by powergirl View Post
???CAN U NAME THE SPECIAL FUNCTIONS A C++ COMPILER CAN CREATE IMPLICITY?
Default and copy constructors, destructor and assignment operator.



Why using isspace(), isdigit(), etc, from <cctype> is dangerous? What's the safe alternative? (Hint: find out why char is different from signed char and unsigned char)
 
Feb14-07, 04:50 PM   #17
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
Retired Staff Staff Emeritus
Quote by DanielKO View Post
Default and copy constructors, destructor and assignment operator.
At the very least, you missed the comma operator. (Does new, new[], delete, and delete[] count too? Hrm)
 
Thread Closed
Thread Tools


Similar Threads for: C++ Quiz starts here...>
Thread Forum Replies
Where does quantum gravity starts ? Special & General Relativity 16
Pull of Gravity.......Where it starts? General Astronomy 3
Physics starts with Archimedes! General Physics 1