0% found this document useful (0 votes)
14 views

Study-Guide-for-Creative-Tech

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Study-Guide-for-Creative-Tech

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Study Guide

1. Which of the following is the correct way to start a C++ program?


 Programs start with #include <iostream> to include the input/output library.
 The main() function is required as the entry point.

2. What is the file extension of a C++ program?


 C++ source files typically use the .cpp extension.

3. Which library is used for input and output in C++?


 The iostream library is used for input (cin) and output (cout).

4. What is the standard namespace in C++?


 The std namespace is the standard namespace and avoids prefixing std:: for objects like
cout and cin.

5. How do you print text in C++?


 Use cout << "Text"; for outputting text.

6. Which symbol is used to end a statement in C++?


 Statements in C++ end with a semicolon (;).

7. What does "int" represent in C++?


 The int data type represents integer numbers.

8. What does the keyword "return" do in a function?


 It sends a value back to the caller and ends the function.

9. What is the output of the following code snippet?


cout << "Hello, World!";

 The output is Hello, World!.


10. Which of the following is a valid C++ comment?
 Use // for single-line comments or /* */ for multi-line comments.

11. What is "cin" used for?


 The cin object is used for taking input from the user.

12. How do you declare a variable in C++?


 Declare variables with the syntax dataType variableName;.

13. Which of the following is NOT a valid data type in C++?


 word is not a valid data type in C++.

14. What is the default value of an uninitialized variable in C++?


 Uninitialized variables have a garbage value.

15. Which loop is guaranteed to execute at least once?


 The do-while loop executes at least once.

16. How do you create a constant in C++?


 Use const variableName; to declare constants.

17. What does "bool" represent in C++?


 The bool data type represents Boolean values (true or false).

18. What is the use of the "if" statement in C++?


 It is used to make decisions based on conditions.
19. How do you start a block of code in C++?
 Use curly braces {} to define a block of code.

20. What is the output of the following code snippet?


int x = 5;
cout << x;
 The output is 5.

21. Which header file is essential for input/output operations in C++?


 The iostream header file is required for input/output operations.

22. What does the following code do?


int arr[5];
 Declares an integer array of size 5.

23. Which keyword is used to define a function in C++?


 Functions can be defined using the syntax returnType functionName().

24. What is the output of the following code snippet?


int a = 10, b = 20;
cout << a + b;
 The output is 30.

25. What will the following code produce?


int x = 10;
x++;
cout << x;
 The output is 11.

26. Which keyword is used to allocate memory dynamically in C++?


 Use new to allocate memory dynamically.

27. Which of the following is NOT a feature of C++?


 C++ is not platform-independent.

28. What symbol is used to declare a pointer in C++?


 Use * to declare pointers.

29. What is the purpose of the "break" statement?


 It terminates a loop or switch statement.

30. What is the output of the following code?


for (int i = 0; i < 3; i++) {
cout << i;
}
 The output is 012.

31. Which of the following is a valid way to declare a string in C++?


 Strings can be declared as string s = "Hello"; or char s[] = "Hello";.

32. What keyword is used to create an object in C++?


 Use the new keyword to create objects dynamically.

33. What is the typical size of an "int" variable in most systems?


 The size of an int is typically 4 bytes.

34. What does the keyword "class" define in C++?


 A class is a blueprint for creating objects.

35. What is the purpose of the "continue" statement in a loop?


 It skips the current iteration and moves to the next one.

36. Which operator is used to access members of a class in C++?


 Use the dot operator (.) or arrow operator (->) for accessing class members.

37. How do you write an exception handler in C++?


 Use try and catch blocks for exception handling.

38. What is the correct syntax for a "for" loop in C++?


 Use the syntax for (int i = 0; i < n; i++) { // code }.

39. What is the purpose of the "delete" keyword in C++?


 The delete keyword frees dynamically allocated memory.

40. What is the purpose of the "private" access specifier in C++?


 The private access specifier restricts access to class members.

You might also like