100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COSC 1436 Exam Questions with All Correct Answers 2024 New Update CA$18.85   Add to cart

Exam (elaborations)

COSC 1436 Exam Questions with All Correct Answers 2024 New Update

 5 views  0 purchase
  • Course
  • COSC 1436
  • Institution
  • COSC 1436

COSC 1436 Exam Questions with All Correct Answers 2024 New Update What software will we be using in class to create programs? - Answer-Visual Studios What is the file extension of the source file (main file) created in an IDE? - Answer-.cpp What does IDE stand for? - Answer-Integrated Devel...

[Show more]

Preview 3 out of 29  pages

  • August 29, 2024
  • 29
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COSC 1436
  • COSC 1436
avatar-seller
COSC 1436 Exam Questions with
All Correct Answers 2024 New
Update
What software will we be using in class to create programs? - Answer-Visual Studios

What is the file extension of the source file (main file) created in an IDE? - Answer-.cpp

What does IDE stand for? - Answer-Integrated Development Environment

What is the answer when the following expression is evaluated:

19 - 3 + 2 * - Answer-17

int x=5, quotient;
quotient = 101/5;

The value in quotient after the above lines are executed is 20.2 T/F? - Answer-False

________ is when you use an informal mixture of C++ and ordinary language to
"outline" your program. - Answer-pseudocode

The execution of a ______ statement in a switch statement immediately exits the switch
structure. - Answer-break

When one decision statement is located within another, it is said to be ______ if
statements. - Answer-nested

Assume the following

int score;
cin >> score;

if (score = 30)
cout << "Grade is an F";
else
cout << "Grade is Passing";

If the user enters a 70, the output of the above code will display the following to the
screen: Grade is Passing.
T/F? - Answer-False

,Suppose that x is an int variable. Which of the following expressions always evaluates
to true?

Select one:

(x > 0) && ( x <= 0)
(x > 0) || ( x < 0)
(x > 0) || ( x <= 0)
( x == 5) && (x == 0) - Answer-(x > 0) || ( x <= 0)

Will the following display a "true" or a "false":

int x=10, y=15, z=20;
if ((x == 5) || (y != z))
cout << "true";
else
cout << "false";

T/F? - Answer-True

Which of the following would correctly test to see if the person in question is at least 21.
The person's age will be stored in the variable: age
if (age >= 21)
if (age < 21)
if (age > 21)
if (age <= 21)
if (age == 21) - Answer-if (age >= 21)

int x = -15;
if (!(x>0))
cout << "true";
else
cout << "false";
What gets printed from the above code? - Answer-true


What's the difference between initializing a variable and assigning a value to a variable?
- Answer-Assigning is storing a value into the variable's memory location. Once you
assign a value, you can reassign another value at any time.

Initializing is simply assigning a value to a variable for the first time.

Declare an integer variable called ageOfStudent and initialize it to 16. - Answer-int
ageOfStudent = 16;

, Declare a doublevariable called tipRateandinitializeit to .20. - Answer-double tipRate =
.20;

Declare twostringvariables called firstName, and lastName, but do not initialize them to
anything - Answer-string firstName, lastName;

Given an integer variable called ageOfStudent (assume it is already set), write a
statement that will
display the value of ageOfStudent. - Answer-cout << ageOfStudent;

Given a double variable called tipRate (assume it is already set to .20), write a
statement that will
display the value of tipRate with two decimal places. - Answer-cout << fixed <<
setprecision(2) << tipRate;

Given two string variables called firstName and lastName (assume they are both
already
initialized), write a statement that will display the values of firstName followed by a
space, followed
by the lastName - Answer-cout << firstName << " " << lastName << endl;

Given two string variables called firstName and lastName (assume they are both
already
initialized), write a statement that will display the values of lastName in a field of 20
spaces (rightjustified), followed by the value of firstName in a field of 20 spaces, also
right-justified). - Answer-cout << setw(20) << lastName << setw(20) << firstName;

Assume that m is an int variable that has already been given a value. Write a statement
that prints
out the value of m in a field of 10 positions. - Answer-cout << setw(10) << m;

Given two integer variables distance and speed, write an expression that
divides distance by speed using floating point arithmetic. - Answer-(double)
distance/speed

Assume that students is an integer variable containing the number of students in a
school, and
that teachers is an integer variable containing the number of teachers in the same
school. Write a
statement that will print out the average number of students per teacher.
Keep in mind that we want the answer to have a decimal number.
Hint: You will need to use type-casting. You may use the long or short version of type
casting - Answer-cout << (double) students/teachers;

. Given an int variable datum that has already been declared, write a statement that
reads an integer

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Scholarsstudyguide. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for CA$18.85. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75632 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
CA$18.85
  • (0)
  Add to cart