Algos Flashcards
Variables - general concept
Hold values which the program will interpret and communicate. They store information for later use. A word is assigned to the information by which it can be retrieved.
Variables - In Java
Different data types based on what kind of information they will store.
Strongly Typed Language - Java
Concept used to refer to a programming language that enforces strict restrictions on intermixing of values with differing data types. When such restrictions are violated an error (exception) occurs. Typing in Java allows the programming language to know with absolutely certainty that the information being stored in a variable will be ‘a certain way’.
Data Types
The types of values within a program.
Primitive Types / Scalar types – JAVA
Simple data types. They relate to a single piece of information.
Control Structures
When the program needs to make a decision: Decision is based on the variables given. The control structures are the decisions that will affect the flow of the code. The code flow is the direction the code is being read by the computer (running program).
Choosing which lines of code to execute and which ones to skip
Dependent on the state of the variables (the value at any given time). While-loop - Purpose: To execute code between ‘{}’ over and over until the condition becomes false.
Data Structures - In Computer Science
A particular way of storing and organizing data in a computer so that it can be used efficiently. Just a way to get around having to create tons of variables.
Syntax - Concept in Computer Science
Set of rules that define the combinations of symbols that are considered to be correctly structured programs in that language. Particular layout of brackets (), curly brackets {}, variables, indentation etc.
Defining a variable in Java
- Variable type 2. Variable’s name 3. Value of the variable
How can we run Java programs in the absence of an IDE?
The default approach is using the command line user interface. The command to compile Java source code is javac. The command to run the Java program is java.
Object-oriented programming (OO programming)
Involves defining classes and then creating objects from those classes. Objects: Parts that the model is built up from are the objects that appear in the problem domain. Represented in a computer program by chunks of computer code. Need to define what information the object will hold (attributes) and what is capable of doing -> Defining a Class. Class file: Where we write the code to specify the attributes (info to be held) and methods (what objects can do).
Problem domain
A problem domain is the area of expertise or application that needs to be examined to solve a problem. A problem domain is simply looking at only the topics you are interested in, and excluding everything else.
Structure of Java Code
In Java few rules about the order in which you choose to define the fields and methods within a class. Important to choose a style and be consistent so it’s easier to read and understand.
Main Method
[Your answer for Main Method was missing in the original]
Declaring and initialising variables
[Your answer for Declaring and initialising variables was missing in the original]
Assigning values to variables
[Your answer for Assigning values to variables was missing in the original]
Indentations
Indicate the block structure applied to for loop, while loop and if-else statements
Interpreting looping constructs while, for and repeat-until, if else conditional construct
Similar to those in Java and Python