Module 1 - Questions
Reflection questions:
Questions to think about:
What motivated you to enroll in this programming class?
What do you hope to learn from this class?
Have you had any prior experience with programming or computer science? If so, what languages have you worked with and what projects have you completed?
What do you think are some of the key skills and characteristics that a good programmer should possess?
What are some of the biggest challenges that you anticipate facing in this class?
How do you think you can best overcome those challenges?
What are your goals for this class, both in terms of what you want to learn and what you hope to achieve?
What kind of programming projects or applications interest you the most, and why?
What do you think are some of the most important ethical considerations for programmers, and why?
How do you think programming can be used to make a positive impact on society?
Variable Names:
What are some good practices for choosing variable names in your programs?
How can variable names affect the readability and maintainability of your code?
What are some common mistakes that programmers make when naming their variables, and how can they be avoided?
Why is it important to use meaningful variable names, especially when working on larger programs with multiple developers?
Program Requirements:
What are program requirements, and why are they important in the development process?
How can you ensure that your program requirements are well-defined and achievable?
How can you use program requirements to create a roadmap for developing your program?
Data Types:
What are data types, and why are they important in programming?
What are some common data types in programming, and how do they differ from one another?
How can you ensure that you are using the correct data type for the variables in your programs?
What are some consequences of using the wrong data type, and how can they be avoided?
Module Questions
What are the steps in the Program Development Life Cycle?
Create Psuedo-code for the following problem:
Suppose you are asked to develop a program that converts dog years to human years. Assume that the computation for dog years is 7 times that of a human year. Your program should ask the user for their dog's name and their dog's age, followed by an output indication of the dogs name and how old it is in human years.
What does the following code snippet output:
double gradeOne = 99.0;
double gradeTwo = 97.00;
double gradeThree = 95.0;
double average = 0.0;
string programHeader = "Welcome to my Grade Calculator!\n";
cout << programHeader;
average = (gradeOne + gradeTwo + gradeThree) / 3;
cout << "The Average is: " << average << endl;
What does the following code snippet output and explain why there is a logical issue:
double gradeOne = 99.0;
double gradeTwo = 97.00;
double gradeThree = 95.0;
double average = 0.0;
string programHeader = "Welcome to my Grade Calculator!\n";
cout << programHeader;
average = gradeOne + gradeTwo + gradeThree / 3;
cout << "The Average is: " << average << endl;
What data type and variable name would you use to store the number of students in this class?
What data type and variable name would you use to store the balance of your bank account?
What data type and variable name would you use to store the name of a video game?
What is the output of the following snippet of code:
What is the output of the following snippet of code:
In the above example, how would you find the length of each of the variables in C++ code?
Explain the keyword const.
Provide the code snippet to prompt a user for their GPA and major (please note you will need to provide the variables)
Provide the code to output the following: “A Tale of Two Cities” (please be sure to include the double quotes in your output.)
What is the output of the following snippet of code:
Provide variable names and data types for the following data points using Camel Case”
Phone Number
Number of children
Number of Players in a computer game
Measurements of a room (room width and room length)
How many characters can be stored in a char data type?
What will the following code snippet output?
a) Hello, world!
b) Hello,world!
c) Hello, world
d) Helloworld!
What will the following code snippet output?
a) 52
b) 5 + 2
c) 7
d) Error
How would you output a backslash (
\\
) usingcout
?
a) cout << "\\\\";
b) cout << "\\";
c) cout << "/";
d) cout << "\\";
What is wrong with the following code snippet?
a) The sequence of input and output is incorrect
b) "Enter a number: "
should be used with cout
not cin
c) There is a syntax error
d) Both a and b
Which of the following would correctly capture an integer input from the user and store it in a variable named
age
?
a) cin << age;
b) cin >> age;
c) cout << age;
d) cout >> age;
What will the value of
x
be after the following code snippet is executed?
a) 7
b) 5
c) 2
d) 25
Which of the following is NOT an assignment operator in C++?
a) +=
b) =
c) ==
d) -=
What will the value of
y
be after the following code snippet is executed?
a) 10
b) 9
c) 11
d) Error
Which operator would you use to divide and assign in a single operation?
a) //=
b) /=
c) = /
d) =/
COSC-1336 / ITSE-1302 Computer Science - Author: Dr. Kevin Roark