0% found this document useful (0 votes)
11 views4 pages

CSC 1 Flashcards

The document provides an overview of programming basics, including how computers solve problems and the role of programming languages. It covers object-oriented programming principles such as encapsulation, abstraction, inheritance, and polymorphism, as well as data storage concepts, loops, functions, common programming mistakes, and debugging techniques. Key programming concepts like variables, data types, logical operators, and function design are also discussed.

Uploaded by

ciastek.elo.320
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

CSC 1 Flashcards

The document provides an overview of programming basics, including how computers solve problems and the role of programming languages. It covers object-oriented programming principles such as encapsulation, abstraction, inheritance, and polymorphism, as well as data storage concepts, loops, functions, common programming mistakes, and debugging techniques. Key programming concepts like variables, data types, logical operators, and function design are also discussed.

Uploaded by

ciastek.elo.320
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming Basics

Q: How do computers solve problems?


A: By performing billions of operations per second.

Q: What do programming languages allow us to do?


A: Communicate with the computer.

Q: What is logic flow?


A: The order in which steps are fulfilled, typically sequential (synchronous) or independent
(asynchronous).

Object-Oriented Programming (OOP) Basics


Q: What does object-oriented programming do?
A: Makes the real world understandable for computers by using classes and objects.

Q: Why are classes useful?


A: They act as blueprints, letting us reuse descriptions without repeating details.

Q: What is a class?
A: A blueprint for creating objects, containing attributes (variables) and methods (functions).

Q: What are the three types of class attributes?


A:

1. Local: Available only within the class.


2. Class-specific: Used without creating an object.
3. Instance-specific: Requires creating an object for access.

Q: What is an object?
A: An instance of a specific class defined by its attributes and methods.

Principles of OOP
Q: What is encapsulation?
A: Keeping an object’s state private, accessible only via public methods, so other classes
can’t directly change its state.

Q: What is abstraction?
A: Reducing complexity by hiding internal implementation details and showing only the
essential functionalities.

Q: What is inheritance?
A: A child class derives from a parent class, reusing its methods and fields while adding its
own unique elements.
Q: What is polymorphism?
A: The ability to use a class like its parent, while each child class keeps its own unique
implementation of methods.

Q: How does encapsulation differ from abstraction?


A:

● Encapsulation: Solves problems at the implementation level by hiding details.


● Abstraction: Solves problems at the design level by simplifying what is shown
externally.

Data Storage
Q: What is a variable?
A: A named storage for data that can be retrieved later.

Q: What are primitive data types?


A:

1. Boolean: True/False or 0/1


2. String: A series of alphanumeric characters (in quotes).
3. Number: Positive/negative values, including decimals.
4. Null: Represents nothingness.

Q: What is an array?
A: A container for storing multiple data items in fixed, zero-indexed buckets.

States, Logical Operators, and Conditions


Q: What is a state in programming?
A: A condition (e.g., true/false, null, undefined) that helps the computer make decisions.

Q: What are the common logical operators?


A:

1. NOT (!): Flips a statement's truth value.


2. AND (&&): True only if all connected conditions are true.
3. OR (||): True if at least one connected condition is true.

Q: What are statements and expressions?


A:

● Statements: Entire lines of code combining expressions.


● Expressions: Elements in a statement that evaluate to a value.

Q: What are the conditions?


A: True/false evaluations used to make decisions, often paired with comparison operators
like >=, <=, ==, or ===.
Loops
Q: What is a while loop?
A: Runs until a condition is met (undefined iterations, end state known).

Q: What is a for loop?


A: Runs for a specific number of iterations (exact count known).

Q: What is an infinite loop?


A: A loop that never stops, potentially causing crashes.

Functions
Q: What is a function?
A: A named series of instructions focused on a specific task, reusable and callable by
name.

Q: What are the 4 steps to designing a function?


A:

1. Define the goal.


2. Define the end result.
3. Define the required input.
4. Implement the logic.

Q: What are parameters and return values?


A:

● Parameters: Values passed into a function.


● Return values: Results output by a function.

Common Programming Mistakes


Q: What are common programming errors?
A:

1. Syntax errors: Missing ; or unmatched brackets.


2. Logical errors: Incorrect logic, such as infinite loops.
3. Scope errors: Misunderstanding global vs. local variables.

Debugging
Q: How can you debug your code?
A:

1. Use console.log to log information in JavaScript.


2. Set breakpoints to pause code execution and inspect variables.

You might also like