100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
NIU CSCI 240 Exam 1 Study Guide Questions And Answers Latest Updates $7.99   Add to cart

Exam (elaborations)

NIU CSCI 240 Exam 1 Study Guide Questions And Answers Latest Updates

 3 views  0 purchase
  • Course
  • NIU CSCI 240
  • Institution
  • NIU CSCI 240

cin >> i; - ️️The code above states that there will be a value inputed (allows the user to input a value)/ associated with i later on. For example it could be used in a way such as i++, if the input value of i is 1 the ++ will incrementally increase i by 1 thus making i 2. assuming th...

[Show more]

Preview 2 out of 8  pages

  • October 10, 2024
  • 8
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • NIU CSCI 240
  • NIU CSCI 240
avatar-seller
ACADEMICMATERIALS
NIU CSCI 240 Exam 1 Study Guide
cin >> i; - ✔️✔️The code above states that there will be a value inputed (allows the
user to input a value)/ associated with i later on. For example it could be used in a way
such as i++, if the input value of i is 1 the ++ will incrementally increase i by 1 thus
making i 2.

assuming that C and F are both declared as doubles, and F has a valid value. -
✔️✔️What's wrong with it is you're always going to get 0 because it is integer division
and 5 does not go into 9 evenly. You can fix it by typecasting or writing 5.0/9 (that will
give you the remainder).


main() marks the beginning of a C++ program. What C++ reserved word precedes it? -
✔️✔️int

Most lines in a C++ program end with a - ✔️✔️; (semi-colon)

According to the lecture notes, the two main conceptual components of a program are
_____ and _____. - ✔️✔️data and instructions

Modify (rewrite) the following instruction so that the subtraction is evaluated first:
i = a * b / c - d; - ✔️✔️i= a*b/(c-d);

About how many decimal places of accuracy does a float have? - ✔️✔️6

Suppose you have two integer variables (named num and sum) with valid values. Write
a single cout instruction to display them as follows:

num is __
sum is __

the underscore characters will show the actual values in num and sum - for example:

num is 4
sum is 24 - ✔️✔️cout<<"num is 4"<<num<<endl<<"sum is 24"<<sum;

The formula for converting a Fahrenheit temperature to Centigrade is 5/9(F - 32). What
is wrong with writing it in C++ as


C = 5/9 * (F - 32);

, About how many decimal places of accuracy does a double have? - ✔️✔️12

What instruction will display data on the screen from a C++ program? - ✔️✔️cout

Name two libraries that should be #include'd at the top of a C++ program. -
✔️✔️#include <iostream>
#include <iomanip>

Explain in detail what the following instruction does (assuming i is declared as int):


Select the three control structures that (along with sequence) will be studied in this
course. - ✔️✔️int
decision
repetition/looping
#include
branch and return/function calling

Name the 3 C++ statements used to create a loop. - ✔️✔️while
for
do while

Write a for loop to display the first 5 multiples of 10 on one line. For example: 10 20 30
40 50 - ✔️✔️for(x=1; x<=5;x++)
cout<<x*10<< " ";

If a read-loop is written to process an unknown number of values using the while
construct, and if there is one read before the while instruction there will also be one -
✔️✔️at the bottom of the body of the loop

Write a decision statement to test if a number is even or not. If it is, print "even". If it is
not, add 1 to it and print "it was odd, but now it's not". - ✔️✔️if(num%2==0)
cout<<"even";
else
{
num++;
cout<<"It was was odd, but now it's not";
}

The three basic loop statements in C++ are while, _______, and _________. - ✔️✔️for
do while

What will the following code fragment print?

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 ACADEMICMATERIALS. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.99. 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
$7.99
  • (0)
  Add to cart