Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ Test 1: Basics

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Qvazzler
Advanced Cheater
Reputation: 0

Joined: 02 Jan 2007
Posts: 68

PostPosted: Sat Oct 20, 2007 12:09 pm    Post subject: C++ Test 1: Basics Reply with quote

Hope you guys don't mind showing off your skills. Smile This is in fact a real test made by my C++ teacher, so there are no fail-questions here.

1. What extension should you use on a sourcefile for C++?

2. Write two simple ways to perform a linebreak in C++

3. Which of the following is the correct way to read an input value to a variable?


variable << cin;
cin > variable;
cin >> variable;
cin(variable);
cin << variable;


4. Which of the following is a condition that checks if a variable's value is between 40 and 80?

if(val >= 40 || val <= 80)
if(val > 40 && val < 80)
if(val >= 40 && <= 80)
if(val >= 40 && val <= 80)


5. Which of these statements are correct? (There are more answers than 1)

Java and C#'s syntaxes look slightly alike
C++ programs can only be compiled in windows
You don't have to compile in order to run a C++ program
Programs in C++ don't crash
C++ came after C.
A C++ program doesn't need a main method


6. Which are the two correct ways to comment in C++?

/* a comment */
//a comment
>> a comment
'a comment
--a comment
<< a comment


7. Which two characters are used to make a 'codeblock'?

8. What sign is used to end a line of code?
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sat Oct 20, 2007 1:05 pm    Post subject: Reply with quote

Ahahahahahahaha.
Back to top
View user's profile Send private message
assaf84
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Oct 20, 2007 1:41 pm    Post subject: Reply with quote

Nice.. Though it's for people who learned C++ for only about a day.. And even less..
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sat Oct 20, 2007 2:03 pm    Post subject: Re: C++ Test 1: Basics Reply with quote

Qvazzler wrote:
3. Which of the following is the correct way to read an input value to a variable?[/b]

variable << cin;
cin > variable;
cin >> variable;
cin(variable);
cin << variable;
NONE!
Code:
std::cin >> variable;
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Oct 20, 2007 7:14 pm    Post subject: Re: C++ Test 1: Basics Reply with quote

Qvazzler wrote:
Hope you guys don't mind doing my homework. Smile
Back to top
View user's profile Send private message
SF
I'm a spammer
Reputation: 119

Joined: 19 Mar 2007
Posts: 6028

PostPosted: Sat Oct 20, 2007 9:29 pm    Post subject: Re: C++ Test 1: Basics Reply with quote

Jani wrote:
Qvazzler wrote:
3. Which of the following is the correct way to read an input value to a variable?[/b]

variable << cin;
cin > variable;
cin >> variable;
cin(variable);
cin << variable;
NONE!
Code:
std::cin >> variable;


You don't have to include the "std::"
I'm assuming his teacher has it at the top of the code

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Oct 20, 2007 10:49 pm    Post subject: Re: C++ Test 1: Basics Reply with quote

SaviourFamily wrote:
You don't have to include the "std::"


Actually, you do.

SaviourFamily wrote:
I'm assuming his teacher has it at the top of the code


Do you mean dumping the contents of std into the current namespace? That's foolish, and any teacher that teaches this to students before teaching them what namespaces are and what their purpose is should be burned at the stake. People also use void for main, it doesn't mean you should assume everyone does.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Oct 21, 2007 12:22 am    Post subject: Reply with quote

1. .cpp
2. "\n\r" and "endl"
3. cin >> variable;
4. if(val > 40 && val < 80)
5. "C++ came after C." The rest are either wrong or opinions, not statements.
6. "/* a comment */" and "//a comment"
7. { and }
8. ;

appalsap wrote:
SaviourFamily wrote:
You don't have to include the "std::"


Actually, you do.


No, you don't. As you said yourself, namespaces handle this for you. (using namespace std;) All depending on if his teacher has shown them what it is and what it does.
Back to top
View user's profile Send private message Visit poster's website
Qvazzler
Advanced Cheater
Reputation: 0

Joined: 02 Jan 2007
Posts: 68

PostPosted: Sun Oct 21, 2007 4:55 am    Post subject: Reply with quote

I meant to post last night but the forum was overloaded (or perhaps it was my internet connection?), and I can admit it was a mistake putting up these questions. Razz

I aced this test when it was given to me, so I guess if I can do it, the whole lot of you can aswell. Smile

Also when it comes to teaching kids who don't know programming for shit, it might be a good idea to ignore some fundamentals until they at least know how to make a "Hello World" app, if you know what I mean. I wasn't taught what namespaces do or <iostream> (although that one was kinda obvious) was at first, but I do now, and it wasn't really that hard to learn. But hey, if you're a teacher, try teaching 15 halfly unmotivated kids the bible of programming..

Edit: Making a new topic on more advanced stuff, note that I've already aced this one aswell (except for 1 lousy mistake as usual Laughing ), feel free to flame inside it too. Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites