Computer Science vs. Information Systems

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following is the primary focus of computer science?

  • Analyzing algorithms and developing new software architectures. (correct)
  • Providing computing solutions for businesses.
  • Managing hardware infrastructure and trained personnel.
  • Facilitating planning and decision-making in organizations.

Information systems primarily focus on the theoretical aspects of algorithms and programming languages.

False (B)

What is the role of the CPU in a computer?

The CPU executes operations and processes data.

A ______ programming language is designed to be easily understood by humans.

<p>high-level</p> Signup and view all the answers

Match the following terms with their descriptions:

<p>Syntax = The form and structure of code, including punctuation and parentheses. Semantics = The meaning and interpretation of a program statement. Compiler = Translates the entire program at once into machine code before execution. Interpreter = Translates and executes code line by line during program runtime.</p> Signup and view all the answers

Which of the following is a characteristic of a compiler?

<p>Translates the entire program at once. (D)</p> Signup and view all the answers

Volatile memory retains data even when the power is turned off.

<p>False (B)</p> Signup and view all the answers

Define 'portability' in the context of programming.

<p>Portability is the ability of a program to run on different machines.</p> Signup and view all the answers

In Python, the ______ function is used to display output to the console.

<p>print</p> Signup and view all the answers

What is the purpose of the def keyword in Python?

<p>To define a function. (C)</p> Signup and view all the answers

The eval() function is generally recommended for handling user inputs because it is secure and prevents malicious code execution.

<p>False (B)</p> Signup and view all the answers

What is the difference between regular division (/) and integer division (//) in Python?

<p>Regular division returns a float, while integer division returns the quotient without the remainder as an integer.</p> Signup and view all the answers

The ______ symbol is used to return the remainder of a division operation.

<p>%</p> Signup and view all the answers

Which of the following operations is known as 'concatenation' when working with strings?

<p>Joining two or more strings together. (A)</p> Signup and view all the answers

In Python, you can only use double quotes to define a string.

<p>False (B)</p> Signup and view all the answers

Explain what a 'for' loop is used for in programming.

<p>A 'for' loop executes a sequence of statements a definite number of times.</p> Signup and view all the answers

In a 'for' loop, the ______ takes on successive values in the sequence.

<p>variable</p> Signup and view all the answers

What is the output of print(int(5.8)) in Python?

<p>5 (B)</p> Signup and view all the answers

The range() function includes the end value in the generated sequence of numbers.

<p>False (B)</p> Signup and view all the answers

What does the term 'string slicing' refer to in Python?

<p>Extracting a portion of a string.</p> Signup and view all the answers

Flashcards

Computer Science

The foundation of computing, studying what can be computed, and a fundamental approach to designing solutions.

Information Systems

A combination of hardware, software, infrastructure, and personnel used for planning, control, coordination, and decision-making.

Software

Programs or instructions that control hardware.

Hardware

The physical machine (e.g., PC, tablet, smartphone).

Signup and view all the flashcards

CPU Role

Fetches instructions, decodes them, and executes them repeatedly.

Signup and view all the flashcards

Volatile Memory

Memory that loses information when power is off.

Signup and view all the flashcards

Nonvolatile Memory

Memory that retains information when power is off.

Signup and view all the flashcards

High-Level Language

Designed to be easily understood by humans.

Signup and view all the flashcards

Low-Level Language

Understood by machines, using instructions represented by zeros and ones.

Signup and view all the flashcards

Syntax

The form of code, including punctuation and parentheses.

Signup and view all the flashcards

Semantics

The meaning of the code.

Signup and view all the flashcards

Compiler

Translates the entire program at once before it is run, converting high-level language into machine code.

Signup and view all the flashcards

Interpreter

Executes code line by line, converting each statement into machine code during the program run.

Signup and view all the flashcards

String Repetition

Repeating a string multiple times using the * operator.

Signup and view all the flashcards

String Concatenation

Joining two or more strings together using the + operator.

Signup and view all the flashcards

Simple Assignment

Assigning a value to a variable using the = symbol.

Signup and view all the flashcards

Simultaneous Assignment

Assigning values to multiple variables simultaneously.

Signup and view all the flashcards

For Loop

A control flow statement that executes a sequence of statements a definite number of times.

Signup and view all the flashcards

Integer Division

Returns the quotient of a division without the remainder, rounding down to the nearest integer.

Signup and view all the flashcards

Remainder Division

Returns the remainder of a division.

Signup and view all the flashcards

Study Notes

  • Gutxi Van Buuren is the name of the recitation TA

Computer Science vs. Information Systems

  • Computer science is a foundation to computing and studies what can be computed

  • Involves designing solutions, algorithm analysis, and experimentation

  • Examples include mobile computing, AI, networking, and databases

  • Information systems coordinate hardware, software, infrastructure, and personnel

  • Facilitates planning, control, coordination, and decision-making in organizations

  • Example: mobile banking

  • Computer science concentrates on:

  • Algorithms

  • Programming languages

  • New software architectures

  • Techniques for complex problem-solving

  • Information systems focuses on providing computing and networking solutions, for employees and customers, that achieve corporate goals

Software vs. Hardware

  • Software consists of programs or instructions that control hardware
  • It's developed through programming.
  • Hardware is the physical machine
  • PC, tablet, and smartphone are all examples

CPU (Central Processing Unit)

  • The CPU is the "brain" of the computer Fetch, decode, and execute instructions are the steps performed repeatedly by the CPU
  • Operations are executed by the CPU
  • Memory processes and stores data

Memory

  • Volatile memory loses information when power is removed.
  • Nonvolatile memory (internal hard drive, secondary memory) retains information in the absence of power
  • Volatile memory does not save when turned off, but nonvolatile memory does

High-Level vs. Low-Level Programming Languages

  • High-level languages are designed to be understood by humans (e.g., Python).
  • Low-level languages are understood by machines/computer hardware
  • Represented by "zeros" and "ones."

Syntax vs. Semantics

  • Syntax is the form of the code, including punctuation and parentheses
  • Semantics is the meaning of the code (e.g., a print statement)

Compiler and Interpreter

  • Compiler: Translates complete programs into machine code before execution, resulting in faster code running
  • Interpreter: Executes code line by line during program run

Portability

  • The exact same program executes on different machines

Programs

  • Print statements are to display a value:
  • print("Hello World") displays "Hello World"
  • print(2+3) displays 5
  • To define a function, start the program with def

For Loop Function

  • Syntax: for <variable> in <sequence>:\n<body>
  • var is the variable (usually i)
  • sequence is a list of values or range of values.
  • Example: for i in [0, 1, 2, 3]:\nprint(i) would output 0, 1, 2, 3
  • for i in range(5):\nprint(i) would output 0, 1, 2, 3, 4
  • for i in range(2,6):\nprint(i) would output 2, 3, 4, 5

Step Function

  • for i in range(1,10,2):\nprint(i) outputs 1, 3, 5, 7, 9

Software Development Process

  • Thinking is the most important thing to do, before you code

Temperature Conversion Program

  • Defines a function to convert degrees Celsius to Fahrenheit
  • \n represents a new line.
  • end ="" is the general format for print function

Inputs

  • Eval should be avoided for security reasons
  • Int represents an integer, which is a whole number with no decimal point
  • >>>int(5.8) results in 5
  • Float represents a floating-point number, which is a number with a decimal point - >>>float(5) results in 5.0`
  • Floating point numbers are approximations.

Mathematical Expressions (Division)

  • "Regular" division:
  • Uses the / symbol.
  • Always returns a float
  • Example: 5/6 results in 0.8333333333334
  • "Integer" division:
  • Uses the // symbol
  • Returns the quotient without the remainder (rounds down to the nearest integer)
  • Example: 5//6 results in 0
  • "Remainder" division:
  • Uses the % symbol
  • Returns the remainder of the two numbers inputted
  • Example: 7%3 results in 1

Strings

  • "Concatenation and Repetition"

  • Strings are textual sequences of characters

  • You can use single or double quotes

  • Concatenation joins strings using +

  • Ex: str1="Hello"\nstr2="World"\nprint(str1 + str 2) will print HelloWorld

  • Repetition repeats a string multiple times using *

  • Ex: str1="Hello"\nprint(str1*3) will print HelloHelloHello

Simple and Simultaneous Assignments

  • Simple assignment: <variable>=<expression>
    • <expr> is evaluated to produce a value, which gets assigned to <variable>
  • Textual input: <variable> = input(<prompt>)
  • Numerical input: <variable>=eval(input(<prompt>))
    • Eval is required when you want a number
  • Simultaneous assignment:
    • Assigns values to multiple variables at the same time

Equal Sign Differences

  • = (single) assigns a value to a variable.
  • == (double) asks if the 2 quantities are equal

For Loop

  • Executes a sequence of statements a definite number of times
  • General format: for <var> in <sequence>:\n<body>
    • <var>: Loop index (usually i or j)
    • Takes on the successive value in the sequence
    • <sequence>: List of values or range of numbers.
    • Statements in the body execute one time per value

Range Function

  • Takes the form range(start value, end value, step size).
  • Example: range(1,5,1) produces 1, 2, 3, 4
  • The end value is not included
  • To include 5, use range(1,6,1).
  • When using range, the function definition is given using range(1, n+1) if the problem asks for an inclusive range.
  • range(0,11,2) produces 0, 2, 4, 6, 8, 10

Math Operations in IDLE Shell

  • Addition: +
  • >>> 3+4 results in 7
  • Subtraction: -
  • >>> 4-3 results in 1
  • Multiplication: *
  • >>> 4*5 results in 20
  • Division: /
  • >>> 23/5 results in 4.6
  • Floor Division or Rounded Division: //
  • >>> 33//6 results in 5
  • Modular Division or Remainder: %
  • >>> 33%6 results in 3
  • Exponent: **
  • >>> 4**2 results in 16
  • Print a string on a new line use \n
  • Print displays what's in the string.
  • Return returns the value.

Def Main and Def Function

  • def main() automatically executes/runs.
  • def function_name() only runs when you type the function

Iterating a For Loop

  • Iterating can be done using range, string, or list

Using Range()

  • range() function generates a sequence of numbers
  • for i in range(5): loops from 0 to 4

Iterating Over a String

  • A string is iterable, so you can loop through its characters.
  • Example:
text = "Python"\nfor char in text:\nprint(char) 
  • Output:
P
y
t
h
o
n

Iterating Over a List

  • Lists are also iterable, so you can loop through their elements
  • Example:
fruits = ["apple", "banana", "cherry"]\nfor fruit in fruits:\nprint(fruit)
  • Output:
apple
banana
cherry

Python

  • Python division types:
  • Regular division (6/4=1.5)
  • Integer division (6//4=1)
  • Remainder division (6%4=2)

Type Conversion and Rounding

  • These conversions are round, int, and float
  • int and float do not support getting multiple values in a single input
  • Example:
  • >>>round(6.789472,3)is 6.790
  • >>>int(3.9847) is 3

Python Math Library

  • Begins with use of import math for function from the library
  • math.sqrt(49) evaluates to 7.0 (square root function)

Accumulator

  • Used in factorial calculations.
  • Determines n! for n>=0.
  • Error if user enters n<0.
  • range(1,n+1) is range(1,) if n==0

Fundamentals of Binary Numbers

  • To represent N=4 value amounts:
  • Represents 2^N or 2^4 = 16 numbers.
  • Largest positive number = (16/2)-1 = 7 = 0 -> 7
  • Most negative number = -8
  • To represent N=5 (byte) amounts:
  • 16 positive ( 0 to 15)
  • 16 negative (-1 to -16)`

Strings in Python

  • Strings are textual data, allowing single or double quotes and are sequences of characters
  • >>>str1="Hello" and >>>str2="spam"
    • print(str1, str2) produces prints 'Hello span '
    • >>>type(str1) returns <class 'str'>
  • In strings the general form uses indexing for selection of expressions in string
  • Expression values determine which character is selected
  • Indexing starts at 0
  • To get the index from the right, use negative index Examples of indexing:
greet="Hello Bob"
012345678
>>>greet[0]
H
  • Slicing is when you return a continuous sequence of characters
<string>[<start>:<end>]
  • string operations are + for concatenation and * for repetition
  • string includes indexing through <string>[]
  • string includes slicing though <string>[<start>:<end>]
  • string includes a function for length len(<string>) ->>>len(spam) gives 4
  • strings iterates through characters useing
    for <var> in <string>

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Introduction to Information Systems
40 questions
Information Systems Overview - Business and Finance
13 questions
Information Systems Concepts
45 questions
Use Quizgecko on...
Browser
Browser