Module 1 - Questions

Reflection questions:

  1. Questions to think about:

    1. What motivated you to enroll in this programming class?

    2. What do you hope to learn from this class?

    3. 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?

    4. What do you think are some of the key skills and characteristics that a good programmer should possess?

    5. What are some of the biggest challenges that you anticipate facing in this class?

    6. How do you think you can best overcome those challenges?

    7. What are your goals for this class, both in terms of what you want to learn and what you hope to achieve?

    8. What kind of programming projects or applications interest you the most, and why?

    9. What do you think are some of the most important ethical considerations for programmers, and why?

    10. How do you think programming can be used to make a positive impact on society?

  2. Variable Names:

    1. What are some good practices for choosing variable names in your programs?

    2. How can variable names affect the readability and maintainability of your code?

    3. What are some common mistakes that programmers make when naming their variables, and how can they be avoided?

    4. Why is it important to use meaningful variable names, especially when working on larger programs with multiple developers?

  3. Program Requirements:

    1. What are program requirements, and why are they important in the development process?

    2. How can you ensure that your program requirements are well-defined and achievable?

    3. How can you use program requirements to create a roadmap for developing your program?

  4. Data Types:

    1. What are data types, and why are they important in programming?

    2. What are some common data types in programming, and how do they differ from one another?

    3. How can you ensure that you are using the correct data type for the variables in your programs?

    4. What are some consequences of using the wrong data type, and how can they be avoided?

Module Questions

  1. What are the steps in the Program Development Life Cycle?

  2. 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.
  1. 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;

 

 

  1. 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;
  1. What data type and variable name would you use to store the number of students in this class?

  2. What data type and variable name would you use to store the balance of your bank account?

  3. What data type and variable name would you use to store the name of a video game?

  4. What is the output of the following snippet of code:

  1. What is the output of the following snippet of code:

  1. In the above example, how would you find the length of each of the variables in C++ code?

  2. Explain the keyword const.

  3. Provide the code snippet to prompt a user for their GPA and major (please note you will need to provide the variables)

  4. Provide the code to output the following: “A Tale of Two Cities” (please be sure to include the double quotes in your output.)

  5. What is the output of the following snippet of code:

  1. Provide variable names and data types for the following data points using Camel Case”

    1. Phone Number

    2. Number of children

    3. Number of Players in a computer game

    4. Measurements of a room (room width and room length)

  2. How many characters can be stored in a char data type?

  3. What will the following code snippet output?

a) Hello, world!

b) Hello,world!

c) Hello, world

d) Helloworld!

  1. What will the following code snippet output?

a) 52

b) 5 + 2

c) 7

d) Error

  1. How would you output a backslash (\\) using cout?

a) cout << "\\\\";

b) cout << "\\";

c) cout << "/";

d) cout << "\\";

  1. 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

  1. 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;

 

  1. What will the value of x be after the following code snippet is executed?

a) 7

b) 5

c) 2

d) 25

  1. Which of the following is NOT an assignment operator in C++?

a) +=

b) =

c) ==

d) -=

  1. What will the value of y be after the following code snippet is executed?

a) 10

b) 9

c) 11

d) Error

  1. 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