Notes, summaries, assignments, exams, and problems for Computer science

C Programming Basics: Examples and Explanations

Computer science2.72 KB

C Programming Basics

Printing a Message

int main() { print("Hello!!!"); }

Variables and Mathematical Calculations

int main() // Main function

{

int a = 25; // Initialize a variable to 25

int b = 17; // Initialize b variable to 17

int c = a + b; // Initialize c variable to a + b

print("c = %d ", c); // Display decimal value of c

}

Floating-Point Math

int main() // Main function

{

float r = 1.0; // Set radius to 1.0

float c = 2.0 * PI * r; // Calculate circumference

print("circumference = %f \n", c); // Display circumference

}

Arrays

int main() // Main function

{

int p[] = {1, 2, 3, 5, 7, 11}; // Initialize the array

print("p[0] = %d\n", p[0]); // Display what p[0] stores

print("p[3] = %d\n", p[3]); // Display what p[3] stores

p[3] = 101; // Assignment

}

...
Continue reading "C Programming Basics: Examples and Explanations" »

Collaborative Study Guide: CSE 12 Complexity, Generics, Data Structures & Algorithms

Computer science64.95 KB

COLLABORATIVE SOLUTIONS FOR PRACTICE PROBLEMS

CSE 12

God help us all

ALL MIGHTY CS LORDS GIVE US MERCY


  • Use the google comment system to ask questions or leave comments on any answer

  • How to use comments: https://support.Google.Com/docs/answer/65129?Hl=en

  • When you write an answer, add the question along with the answer

  • Add an explanation for your answer

  • Always doubt everyone else’s answers until you confirm for yourself they’re correct

____________________________________________________________________________

Complexity Problems



  1. Consider a small array a and large array b. Accessing the first element of a takes more/less/the same amount of time as accessing the first element of b.


A. The same amount of time

B. Less time  

C. More time

Should be the same...

Continue reading "Collaborative Study Guide: CSE 12 Complexity, Generics, Data Structures & Algorithms" »

Understanding SDLC Models and System Analysis Techniques

Computer science94.48 KB

Define SDLC models? What are the most known SDLC model?

An SDLC model defines implementation of an approach to the project. It defines the various processes, and phases that would be carried out throughout the project to produce the desired output. There are a variety of SDLC models that exist catering to different needs and characteristics of a project. Some are of iterative nature (Prototyping), whereas some are sequential (waterfall).

Some of the well-known SDLC models are:
Waterfall model, Software prototyping, Rapid application development,

Extreme programming, and End user development. 

List Advantages of using system analysis and design techniques in approaching computerized info system?

  • Identifies and solves the right problems
  • Implement
...
Continue reading "Understanding SDLC Models and System Analysis Techniques" »

Understanding MapReduce Design Patterns

Computer science18.71 KB

MapReduce is a computing paradigm for processing data that resides on hundreds of computers, which has been popularized recently by Google, Hadoop, and many others. The paradigm is extraordinarily powerful, but it does not provide a general solution to what many are calling “big data,” so while it works particularly well on some problems, some are more challenging. This book will teach you what problems are amenable to the MapReduce paradigm, as well as how to use it effectively. At first glance, many people do not realize that MapReduce is more of a framework than a tool. You have to fit your solution into the framework of map and reduce, which in some situations might be challenging. MapReduce is not a feature, but rather a constraint....

Continue reading "Understanding MapReduce Design Patterns" »

Database Architecture and Management Systems

Computer science3.02 KB

Database Architecture

The definition of an information system is the detailed description of the system architecture.

Internal Level

The lowest level of abstraction, defining how data is stored on hardware and accessed. Responsibilities of the Database Administrator (DBA) include managing:

  • Block size
  • Relative position of stored records
  • Addressing methods
  • Overflows
  • Indexing
  • Storage changes
  • Compression techniques

Conceptual Level

The mid-level of abstraction, representing the organization's data. This level encompasses partial views of different users' requirements and potential uses. It provides a total organizational vision, including data definitions and relationships. DBA responsibilities include:

  • Defining the data stored in the database:
    • Data name
    • Attributes
    • Relationships
...
Continue reading "Database Architecture and Management Systems" »

Understanding Computer Systems: Hardware, Software, and Key Concepts

Computer science3.17 KB

1. Computer System

The set of physical elements (Hardware) and software (Software) that allow information processing.

2. Physical Subsystem

Commonly known as hardware.

3. Logical Subsystem

Referred to as software.

4. Computer

An electronic device capable of processing data, performing load, arithmetic, and logic operations without human intervention.

5. Informatics

The science that studies the automatic and rational treatment of information.

6. Automatic and Rational

  • Automatic: Tasks are performed by machines.
  • Rational: Processes follow human reasoning.

7. Central Processing Unit (CPU)

Responsible for implementing programs and comprises the main memory, control unit, and arithmetic-logic unit.

8. Supercomputer

A specialized machine designed for tasks requiring...

Continue reading "Understanding Computer Systems: Hardware, Software, and Key Concepts" »

MS-DOS Memory Management: Conventional, Upper, Expanded

Computer science3.53 KB

MS-DOS Memory Management

The memory management depends on the version of MS-DOS we use and the CPU that we have.

Processor Memory Limits

Processors have different address limits:

  • 8088 / 8086 (XT): handle up to 1 MB
  • 286 (AT): handle up to 16 MB
  • 386: handle up to 4096 MB

Conventional Memory

Conventional memory is where programs run; you must manage it properly and release memory when possible.

0 Kb

S.O.

Contains the interrupt table, computer specification, etc.

2 KB

Core MS-DOS Files

The core files include (examples by version):

  • IO.SYS (depending on the version)
  • MSDOS.SYS (system)
  • Other variable core components

Order File (CONFIG.SYS)

Configuration directives and settings found in CONFIG.SYS:

  • BUFFERS
  • FCBS
  • FILES
  • LASTDRIVE
  • STACKS

Device Drivers

Device drivers loaded via

...

Continue reading "MS-DOS Memory Management: Conventional, Upper, Expanded" »

Computer Architecture Fundamentals: CPU, Memory, Buses, and Addressing

Computer science3.52 KB

Core Computer Architecture Components

CPU Registers Explained

CPU registers are small, high-speed storage locations within the central processing unit (CPU) that hold data and instructions for immediate processing.

Accumulator Register

The Accumulator Register stores the results of executed operations. It connects to input registers for feedback in chained operations and also connects to the data bus for sending results to main memory or the control unit.

Program Counter (PC)

The Program Counter (PC) stores the memory address of the next instruction to be executed.

Instruction Register (IR)

The Instruction Register (IR) contains the instruction currently being executed.

Understanding Computer Buses

A bus is a channel or set of parallel connections that...

Continue reading "Computer Architecture Fundamentals: CPU, Memory, Buses, and Addressing" »

Process Planning and Scheduling in Operating Systems

Computer science4.92 KB

Process Planning

Objectives

  • Justice: Avoid favoring some processes over others.
  • Maximum Number of Interactive Users: Focus on most time-sharing systems.
  • Predictability: The strategy must enable the execution of processes.
  • Minimizing Overhead: Minimize context switches.
  • Balance in the Use of Resources: Resources must be used fairly and for as long as possible.
  • Safety Priorities: Established priorities should be respected.
  • Maximum Capacity of Execution: Minimize process changes.

Criteria

  • Response Time: Speed with which the system responds to a request.
  • Service Time: Response time minus time for I/O.
  • Runtime: Service time minus timeout.
  • Processor Time: Processor time occupation.
  • Timeout: Waiting times in queues.
  • Efficiency: Processor utilization.
  • Yield: Number
...
Continue reading "Process Planning and Scheduling in Operating Systems" »

Digital Sound and Video: Formats, Properties, and Tools

Computer science4.86 KB

Digital Sound Features

Sample Rate: The number of samples per second taken from a continuous analog signal to make a discrete digital signal. For example, CD-quality digital audio uses 44,100 Hz.

Channels: The number of audio channels in a sound recording. Mono = 1, Stereo = 2, 5.1 = 5 channels.

Sample Size: Indicates the number of bits of information in each sample. CD-quality audio uses 16 bits.

Formula: Size = Frequency x Sample Size x Number of Channels x Time (in seconds).

Audio Formats

WAV: A digital audio format without compression. It supports mono and stereo files, and its extension is .wav. It is seldom used on the internet. Microsoft and all programs recognize it.

MIDI: A protocol for communication between digital musical instruments and...

Continue reading "Digital Sound and Video: Formats, Properties, and Tools" »