100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COMP 218 study questions and answers 2024 $12.99   Add to cart

Exam (elaborations)

COMP 218 study questions and answers 2024

 4 views  0 purchase
  • Course
  • COMP 218
  • Institution
  • COMP 218

Definitions - A set of instructions written in a specific programming language that causes a computer to perform a specific task is referred to as COMPUTER PROGRAM. RAW FACTS are referred to as date while PROCESSED FACTS are referred to as information. A language with strict grammar rules, symbols ...

[Show more]

Preview 3 out of 21  pages

  • August 25, 2024
  • 21
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COMP 218
  • COMP 218
avatar-seller
CleanA
COMP 218 study questions and answers
2024
LESSON 1 -


Definitions - A set of instructions written in a specific programming language that
causes a computer to perform a specific task is referred to as COMPUTER
PROGRAM. RAW FACTS are referred to as date while PROCESSED FACTS are
referred to as information. A language with strict grammar rules, symbols and
special words used to construct a computer program is a PROGRAMMING
LANGUAGE. A step-by-step list of instruction that, when carried out, produces a
solution to a problem is referred to as ALGORITHM.


Given the algorithm in the leap year case study
Divide the year by 4 and if the remainder isn't 0Return false (The year is not a leap
year)Otherwise, divide the year by 100 and if the remainder isn't 0,Return true
(The year is a leap year)Otherwise, divide the year by 400 and if the remainder
isn't 0,Return false (The year is not a leap year)Otherwise, Return true (the year is
a leap year)
Decide whether the following years are leap years:
a. 1900
b. 2000
c. 1996
d. 1998 - a. 1900 No
b. 2000 Yes
c. 1996 Yes
d. 1998 No

,Given the algorithm from the leap year case study with the lines numbered as
follows:
1. Divide the year by 4 and if the remainder isn't 0
2. Return false (The year is not a leap year)
3. Otherwise, divide the year by 100 and if the remainder isn't 0,
4. Return true (The year is a leap year)
5. Otherwise, divide the year by 400 and if the remainder isn't 0,
6. Return false (The year is not a leap year)
7. Otherwise, Return true (the year is a leap year)


Indicate which line of the algorithm tells you whether the date is a leap year in
each of the following cases:
a. 1900 Line =
b. 1945 Line =
c. 1600 Line =
d. 1492 Line =
e. 1776 Line = - a. 1900 Line = 6
b. 1945 Line = 2
c. 1600 Line = 7
d. 1492 Line = 4
e. 1776 Line = 4


How would you extend the leap year algorithm to tell you also when a year is a
millennium year (a multiple of 1000)? - Divide by 1000 and see if the remainder is
0.


LESSON 2 -

, Mark the following identifiers as either valid or invalid.
a. theDog e. DVD_ROM
b. all - In - On f. Elizabeth_the_2nd
c. const g. 2morrow
d. recycling h. page# - a. valid
b. invalid (hyphens not allowed)
c. invalid (reserved words not allowed)
d. valid
e. valid
f. valid
g. invalid (must begin with a letter)
h. invalid (# is not allowed)


Write a single output statement that outputs the following three lines:
He said, "How is that possible?"
She replied, "Using manipulators."
"Of course!" he exclaimed. - Note that the \" escape sequence is needed in six
places here:
cout << "He said, \"How is that possible?\"" << endl
<< "She replied, \"Using manipulators.\"" << endl
<< "\"Of course,\" he exclaimed!" << endl;


What is the result of each of the following expressions?
a. 27 + - 7
b. 27.0 + 8..0 - 7.0

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

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80189 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
$12.99
  • (0)
  Add to cart