Computer Science Chapter1-4

Cards (217)

  • Computers process data under the control of instructions called Program
  • A computer's key logical units

    • input unit
    • output unit
    • memory unit
    • central processing
    • arithmetic unit
    • logic unit
    • secondary storage unit
  • Types of programming languages discussed in the chapter
    • machine languages
    • assembly languages
    • high-level languages
  • Compilers
    Programs that translate high-level-language programs into machine language
  • Android is an operating system for mobile devices based on the Linux kernel
  • An acceleromoter allows a device to respond to motion
  • C is widely known as the language of the UNIX operating system
  • C programs
    Normally typed into a computer using an editor
  • C program compilation process
    1. Preprocessor executes
    2. Translation phase
    3. Linker combines output of compiler with library functions
    4. Loader transfers executable image from disk to memory
  • C
    • Facilitates a structured and disciplined approach to computer-program design
  • Comments
    Document programs and improve program readability
  • Comments are ignored by the compiler
  • Preprocessor
    Processes lines beginning with # before the program is compiled
  • #include directive
    Tells the preprocessor to include the contents of another file
  • <stdio.h> header
    Contains information used by the compiler to ensure correct use of standard input/output library functions, such as printf
  • main function
    Part of every program, where the program begins executing
  • int
    Indicates that main "returns" an integer (whole number) value
  • void
    Indicates that main does not receive any information
  • Left brace {
    Begins every function's body
  • Right brace }

    Ends each function
  • Block
    A pair of braces and the code between them
  • printf function
    Instructs the computer to display information on the screen
  • String
    Sometimes called a character string, a message or a literal
  • Statement
    Must end with the semicolon statement terminator
  • Escape character \

    When encountering a backslash in a string, the compiler combines it with the next character to form an escape sequence
  • Escape sequence \n

    Means newline
  • Escape sequence \\

    Places a single backslash in a string
  • Escape sequence \"
    Represents a literal double-quote character
  • Variable
    A location in memory where a value can be stored for use by a program
  • int

    Holds whole-number integer values
  • Identifier
    A series of characters consisting of letters, digits and underscores ( _ ) that does not begin with a digit
  • C is case sensitive
  • scanf function

    Gets input from the standard input—usually the keyboard
  • scanf format control string
    Indicates the type(s) of data to input
  • %d conversion specification

    Indicates an integer (the letter d stands for "decimal integer")
  • Address operator &
    Tells scanf the variable's memory location
  • Assignment statement

    Most calculations are performed in
  • Binary operators
    = and + each have two operands
  • printf format control string

    Conversion specifications indicate placeholders for data to output
  • Destructive
    When a value is placed in a memory location, it replaces the location's previous value, which is lost