Original Post
Quizzes and Extra Credit assignments for Week 1.
Post your answers to the Extra Credit assignment and Quizzes from Week 1 here rather than in the workshop thread, so as not to spoil things for the others.Invisal's Extra Exercises
It is 5th day for C++ Workshop and I want to give some Extra Exercises for testing their understand and improve their programming skill. 1. Write a program that print your name on the screen. 2. Track the errors on this code then fix the errors and guess what is this code do without using the compiler. There are 13 errors in this code
#include <iostream>
int main()
{
cout >> "There are many mistakes in this code." >> std::endl
cout >> "Can you help me fix all the bugs in this code" >> end >> endl;
cout >> "Thank You!" >> std::endl;
}
3. Write a program that display something like this:
*******
*****
*******
*****
4. Write a program that ask the age of the user and display it on the screen. For example:
How old are you? : 21
You are 21 years old
5. Write a program that ask user to insert 2 numbers and then display the summary, subtraction and multiplication between those two numbers. For example:
Please insert your first number: 5
Please insert your seond number: 2
The summary is: 7
The subtraction is: 3
The multiplication is : 10 Enjoy! JWalsh's Quizz
Listed below are a set of quiz questions to help you test your knowledge and understanding of the material contained in chapters 1 and 2. Each chapter builds upon the knowledge obtained in previous chapters, so it can be dangerous and confusing to advance to later chapters without a complete understanding of the material already covered. If you are unable to answer these questions, please ask for assistance, but DO NOT POST THE ANSWERS IN THE MAIN WORKSHOP THREAD. Any questions which is not marked with [Extra Credit] can be answered by reading your textbook. Questions which are marked [Extra Credit] either have been answered in the thread previously, or can be answered by doing a bit of research. Chapter 1- What is an interpreter?
- What is a compiler?
- Why is compiled code faster than translated code?
- What does structured programming (procedural programming) consist of?
- What were the primary problems object oriented programming was designed to solve?
- What are the three pillars of object oriented programming? Does C++ support them all?
- What is encapsulation?
- What is inheritance?
- What is polymorphism?
- Should you learn C before C++, why or why not?
- What is the FIRST question you ask when beginning your designs?
- What is the SECOND question you ask when beginning your designs?
- What are the two primary steps in creating an executable? What is the output of each step?
- If your compiler requires
does it follow the ANSI standard? What IS the standard?
- When you issue a command to compile your code, what is run first? What does it do?
- What symbol indicates a preprocessor directive?
- What does an "include" directive instruct the preprocessor to do?
- What is the necessary function which all console C++ programs have?
- Who calls that function?
- Can you declare main as void? Why use int instead?
- Are "curly braces" optional when enclosing a function?
- What is the Standard Library?
- How do you instruct the compiler that you want to use part of the Standard Library?
- [Extra Credit] What's the difference between "\n" and endl?
- What are the 3 ways to use a class in a namespace? Use "cout" as an example.
- What are the two types of comments?
- [Extra Credit] What is self-documenting code? Does that remove the need for comments?
- Are the 3 components of a function declaration (function header)?
- What do you call a function that is part of a class?
- [Extra Credit]What does a compiler do with "white space?"