Document Details

ChampionStar1508

Uploaded by ChampionStar1508

DG Junior

2023

STI

null

Tags

programming computer science programming paradigms computer programming

Summary

This document is an introductory overview of programming concepts, including programming languages, paradigms, and terminologies. It discusses the evolutionary history of programming, different programming paradigms, and various programming languages.

Full Transcript

IT2402 Basics of Programming Programming Basics (DG Junior, 2023) A computer program is a sequential set of instructions, known as codes, written or “programmed” in a computer language to let the computer perform a specific computation task. Examples include sys...

IT2402 Basics of Programming Programming Basics (DG Junior, 2023) A computer program is a sequential set of instructions, known as codes, written or “programmed” in a computer language to let the computer perform a specific computation task. Examples include system software, web browsers, utility software, multimedia software, and spreadsheet software. It is important to note that the set of instructions in a computer program must be performed sequentially unless directed otherwise. The instructions in the set will express a unit of work that a computer language can support. A computer language is a set of grammatical rules that commands a computer or a device to behave in a specific way. It also refers to programming language. Programming It is the art and science of instructing computers to perform tasks using a specific programming language. It creates codes that tell a computer how to solve problems and accomplish various operations. By writing code in programming languages, programmers can develop computer programs or software applications, design websites, analyze data, and automate processes, among other operations. As programming becomes a sought-after skill in various industries, proficiency in programming opens up myriad career opportunities, from software development and web development to data science and artificial intelligence. Programming also enhances critical thinking, logical reasoning, and problem-solving abilities that help programmers break down complex tasks into manageable steps and develop efficient algorithms. Evolution and History of Programming Programming involved writing machine code initially. This consisted of binary instructions (0 and 1) directly communicating with the computer’s hardware. As technology progressed, high-level programming languages developed to simplify the coding process. These languages allowed programmers to write code using more human-readable syntax. Currently, a wide ecosystem of programming languages and tools caters to different programming paradigms and application domains. Programming Paradigms The term “paradigm” is synonymous with “pattern.” These refer to the different approaches to structuring and organizing code. These provide a conceptual framework for solving problems and designing software. Here are some commonly used programming paradigms: Procedural Programming – or imperative programming, focuses on organizing code into reusable procedures or functions, emphasizing the sequence of steps to execute a program. Examples include BASIC, C and C++, Pascal, and Java. Object-oriented programming (OOP) – revolves around the concepts of objects that encapsulate data and behavior that promotes modularity, code reusability, and scalability. Examples include Python, VB.NET, and C#. Functional Programming - treats computation as evaluating mathematical functions, emphasizing consistency, and avoiding side effects. The nature of the project, requirements, and the desired programming style are some of the basis for choosing the appropriate programming paradigm. 01 Handout 1 *Property of STI  [email protected] Page 1 of 5 IT2402 Programming Languages Numerous programming languages are available, each with its unique syntax, features, areas of specialization, and community support, making it suitable for specific projects. This can be classified into two (2) Low-level and high-level languages. Low-level Language – a programming language closer to machine code and hardware in terms of syntax. It provides direct control over the computer’s hardware and resources, allowing programmers to write code at a more detailed level. It is commonly used for tasks requiring precise control and efficient execution. Examples of this language include the following: o Assembly Language – uses specific instructions to control a computer’s hardware. o Machine Language – all instructions are written as binary numbers (1 and 0). High-level Language – a programming language designed to be easy for humans to read, write, and understand, allowing programmers to write computer programs and interact with a computer system without needing specific knowledge of the processor or hardware that the program will run on. Examples include C++, Pascal, PHP, Python, and Java. Choosing a programming language depends on different factors such as project requirements, performance needs, community support, and available libraries or frameworks. Other Programming Terminologies Here are some terminologies that can be useful to understand programming further. Syntax It is a set of rules defining the various combinations and arrangements of symbols or characters to create a valid statement in a language. Command It is the unique instruction given to a computer application to perform a task of a function such as “print” to display text on the screen. Integrated Development Environment (IDE) It is a software application for formatting the code, checking the syntax, and running and testing the code. IDEs can work with multiple programming languages, while some are specific to only one language. Library It is a collection of useful resources, such as objects and functions, that can be used individually and must be configured to work together. It is pre-built or installed in an IDE or Integrated Development Environment. Interpreter It is a program that directly executes instructions in a high-level language without converting them into a machine language. Assembler It is a program that converts instructions written in low-level assembly code into relocatable machine language. Compiler It is a program that converts high-level languages into machine-readable code that a computer can execute. 01 Handout 1 *Property of STI  [email protected] Page 2 of 5 IT2402 Algorithm, Pseudocode, and Flowchart (Chaudhuri, 2020) In programming, an algorithm is a set of steps that generates a finite sequence of simple computational operations leading to the solution of a given problem. It must be expressed in a natural language that anyone can follow, such as directions that can be written in English. Example: Design an algorithm that finds and displays the volume of a rectangle. It is required to know the rectangle’s length, width, and height, and the formula for finding its volume. The formula is volume = length × width × height. The algorithm to find and display the volume of the rectangle is as follows: 1. Get the length of the rectangle 2. Get the width of the rectangle 3. Get the height of the rectangle 4. Find the volume using the formula: volume = length × width × heights 5. Display the computed volume The algorithm is also part of the problem-solving process in the programming environment. The complete steps include: 1. Problem Analysis – evaluating and outlining the problem and its solution requirements 2. Algorithm Design – designing an algorithm to solve problems. 3. Coding – implementing the algorithm in a programming language. 4. Execution – verifying whether the algorithm works or not. The two (2) commonly used tools in representing algorithms are through a pseudocode or a flowchart. Pseudocode It is a technique used to describe distinct steps of an algorithm that is much easier to understand for anyone with basic programming knowledge. Here are some rules that are frequently followed when writing pseudocode: Symbols that are used for common operations: o Arithmetic operations (+, -, *, /) o Comparison (=, ≠, , ≤, ≥) o Assignment (=) o Logical (and, or) Keywords can be used as a command, such as PRINT, WRITE, READ, SET, and GO TO. Indentation is used to indicate branches and loops of instructions. Example: Using the same example above: The pseudocode to find and display the volume of the rectangle is: READ length READ width READ height SET volume to 0 COMPUTE volume as length * width * height PRINT volume 01 Handout 1 *Property of STI  [email protected] Page 3 of 5 IT2402 Flowchart It is a diagrammatic representation of the steps of an algorithm. It is a pictorial representation that can be used as a substitute for an algorithm, as a textual description of an algorithm may not be understood easily. Flowcharts are classified into two (2) categories: Program flowcharts and System flowcharts. Program flowcharts – illustrate the logical steps in a software program or programming task to understand a process, workflow, or algorithm. They contain the steps of solving a problem unit for a specific result. System flowcharts – show how parts of a system work together by displaying the data flow and how decisions can affect the events surrounding it. Boxes of different shapes are used to represent various types of operations. Lines then connect these boxes with arrows representing the direction or flow to which one should proceed to know the next step. Here are the standard symbols used in program flowcharts. Symbol Name Description Shows the start and end of a set of Terminal computer-related processes Input/Output Shows any input/output operation Shows any processing performed by a Computer Processing computer system Indicates any process not specially defined Predefined Processing in the flowchart Used for writing any explanatory Comment statement required to clarify something Flow line Used for connecting the symbols Used when input comes from a document, Document Input/Output and output goes to a document Shows any point in the process wherein a Decision decision must be made to determine further action Connects parts of a flowchart continued on On-page Connector the same page Connects parts of a flowchart continued to Off-page Connector separate pages Table 1. Flowchart symbols. Retrieved from Chaudhuri, A. (2020). Flowchart and algorithm basics: The art of programming. Mercury Learning and Information. Example: 01 Handout 1 *Property of STI  [email protected] Page 4 of 5 IT2402 Using the example in Algorithm: The flowchart to find and display the volume of the rectangle is: Five (5) Rules for Creating Program Flowcharts The following rules must be observed while creating program flowcharts. Only the standard symbols should be used in program flowcharts. The program logic should only show the flow from top to bottom and/or left to right. Each symbol should contain only one entry point and one exit point, except the decision symbol. It is known as the single rule. The operations shown within a symbol should be expressed independently of any programming language. All decision branches should be well-labeled. References: Chaudhuri, A. (2020). Flowchart and algorithm basics: The art of programming. Mercury Learning and Information DG Junior (2023). Basics of programming: A comprehensive guide for beginners. DG Junior. 01 Handout 1 *Property of STI  [email protected] Page 5 of 5 IT2402 Introduction to Java The Java Environment (AWS, n.d.a.) Java is a free-to-use and highly dynamic high-level programming language for coding programs such as web applications, mobile applications, enterprise software, big data applications, and server-side technologies. It was created by Sun Microsystems in 1995 as a multi-platform, object-oriented, and network-centric language that can be used as a platform in itself. The common uses of Java include game development, cloud computing, big data, artificial intelligence (AI), and Internet of Things. Java Runtime Environment (JRE) It is the software that Java programs require to run correctly. It provides the class libraries and other resources that any Java program needs. The advantages of using Java include the following: o Active Community Support: Given its popularity and longevity, Java has many active users and a community that can support developers. o High-Quality Learning Resources: Learning resources such as detailed documentation, comprehensive books, and courses are available to new programmers for additional support. o Inbuilt Functions and Libraries: Developers do not need to write every new function from scratch, as Java provides a rich ecosystem of built-in functions and libraries to develop various applications. o Security: The Java security levels and restrictions are highly configurable. An untrusted Java code can be downloaded and run in a secure environment in which it cannot do any damage. The untrusted code also cannot damage the host system with a virus, nor can it read or write files from the hard drive. o Platform Independent: Java code can be written once and run on any underlying platform like Windows, iOS, Android, and Linux without rewriting. This feature is called the “Write Once, Run Anywhere” (WORA) Philosophy which became a highly sought feature by developers. To use Java, a developer must understand two (2) things: Java Virtual Machine and Java Language and APIs. Java Virtual Machine (JVM) It is a virtual machine that runs Java applications as a run-time engine. Natural programming languages fall into two (2) broad categories: compilers and interpreters. Compilers: The program is written in natural English-like syntax with compilers, and the language then translates the entire code into machine language. It converts the source code into a binary program of bytecode. Interpreters: This checks the bytecode and communicates with the operating system, executing the bytecode instructions line by line. Java was the first programming language to combine both using a Java Virtual Machine (JVM). A JVM is an environment that translates Java bytecode, an intermediate-level language, into machine language and executes it. The programming statements or source code are stored on a disk with a.java file extension. The Java compiler converts the source code into a binary program of bytecode. The Java interpreter will then check the bytecode and communicate with the operating system, executing the bytecode instructions line by line within the Java 02 Handout 1 *Property of STI  [email protected] Page 1 of 4 IT2402 Virtual Machine, named java.exe. Java APIs APIs (Application Programming Interface) are important software components bundled with the Java Platform. Java APIs are pre-written Java programs that plug and play existing functionality into a code, such as getting the time and date, performing mathematical operations, or manipulating text. The Java language has only about 50 keywords, but the Java API has several thousand classes, with thousands of methods that can be used in any program. Java Skeleton (Soma, T. & Streib, J., 2023) The best way to understand a programming language is by dissecting and examining its sample program. Here is a simple example of a Java program that prints or displays “First Java Application”: 1 class Skeleton { 2 public static void main (String[] args){ 3 System.out.println("First Java Application"); //for display 4 } 5 } Line 1 begins with the reserved word or keyword class. A class is the basic unit of a Java program. It also defines a group of objects that includes data members, which are places to store data, and methods which are places to put the program logic. Think of a class as a blueprint for a house and the house itself as the object. On the same line, the word Skeleton is the class name provided by the programmer. A class name is a type of an identifier. An identifier is the name given to a program component, such as a class, object, or variable. These are the requirements for naming an identifier: It must begin with a letter of the English alphabet, an underscore (_), or a dollar sign ($), but not with a digit. It can have any combination of letters, digits, underscores, or dollar signs, but not with white spaces. It is case-sensitive such as the identifier NUMBER is not the same as the identifier number or Number. It cannot be one of the following values: true, false, or null. These are not keywords; they are primitive values but reserved and cannot be used. It cannot be a reserved word. Reserved Words Reserved words or keywords are special words significant to the Java compiler. Aside from class names, these cannot be used as variables, a name used to refer to data stored in the memory. Here is a list of Java keywords: abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while 02 Handout 1 *Property of STI  [email protected] Page 2 of 4 IT2402 Still, on line 1, braces are used to identify blocks of code and data. It requires matching opening ( { )and closing braces ( } ). Thus, the whole definition of the class Skeleton should be between the first opening brace and the last closing brace on line 5. The Skeleton class has one (1) method definition on line 2. The method is intended to improve the readability of the program. The first three words (public static void) in line 2 are reserved words. The public keyword is a type of access or visibility modifier. This keyword is used to define a main() method so that the interpreter can execute the program. The static keyword tells that this is a class method. The main method is always declared static so that it can be executed without creating an object of the class. The void keyword means that the main is a non-value-returning method, which means the main is not expected to return any value. The word main after the three (3) keywords is the name of the method. When executing a Java program, the execution must always begin with the main method. All Java applications must include a class containing one (1) main method. Inside the parentheses after the method name, parameters are listed along with their types to allow the method to receive values. The main method has a parameter called args, an array of type String, and the square brackets [] indicate args is an array. An array is a collection of similar data types, while a string is a sequence of characters containing letters, numbers, and symbols. The definition of the main method starts with an opening brace (end of line 2) and ends with a closing brace (line 4). This sample Java program contains one (1) programming statement or command in line 3: A literal string is a series of characters that appear exactly as written and is always enclosed by double quotation marks (","). Arguments are information passed to a method so it can perform its task. A Java statement such as the one above is an executable instruction that commands the compiler what to do. A comment can also be found at the end of line 3: //for display. Comments provide additional information to make programs easier for programmers and other programmers to understand. Comments will not be compiled and executed when the program is run. A comment line can start with // symbols and continue to the end of the line. This type of comment line is used for a single-line comment. Comments can also be placed between symbols if the comments run over multiple lines. 02 Handout 1 *Property of STI  [email protected] Page 3 of 4 IT2402 Saving, Compiling, and Executing a Program (Agarwal, S. & Bansal H, 2023) Java Development Kit (JDK) includes complete JRE tools for developing, debugging, and monitoring Java applications. JDK must be installed on the computer to write, compile, and execute Java programs. Here is a sample program to be saved, compiled, and executed using the command prompt (CMD): Step 1: Write the following code in a text editor such as Notepad (or any text editor.) public class Demo { //program begins from here starts with public static void main (String a []) { System.out.println("First program in Java"); } } Step 2: If using a Notepad as an editor to write a program, the file must be saved with double quotes (","). Otherwise, it automatically adds a.txt extension. The sample program above should be saved as "Demo.java". Step 3: Open the DOS window (cmd), then change the directory to the directory where the Java file was saved. Step 4: Set the path of JDK using the path command. This setting tells the operating system where to find the Java compiler and the classes. Setting the path of JDK is defined as set path=%path%;[JDK bin directory] Step 5: Compile the Java program using the javac command: javac [name of the Java file].java Step 6: Execute the compiled Java program using the java command (interpreter): java [name of the Java file] Output: Figure 1. Output. Retrieved from Agarwal, S. & Bansal H. (2023). Java in depth. BPB Publications. References: Agarwal, S. & Bansal H. (2023). Java in depth. BPB Publications. AWS (n.d.a). What is Java? [Web Articile]. Retrieved on February 7, 2024, from https://aws.amazon.com/what-is/java/ Soma, T. & Streib, J. (2023). Guide to Java: A concise introduction to programming. Springer. 02 Handout 1 *Property of STI  [email protected] Page 4 of 4 IT2402 Data Types Data encoded to a program is stored in memory and can have and be in several types—for example, using a person’s basic information such as name, age, and address. The name will be stored as characters, the age will be stored as a numeric value, and the address will be stored as an alphanumeric value. Data Types describe possible operations on the data and the storage method. The data types in Java are classified into two (2): primitive or standard data types and abstract or derived data types. Primitive Data Types (Agarwal & Bansal, 2023) Primitive Data Types are built into the Java language. These are data that are not objects and have no methods. The Java compiler has detailed instructions on the valid operations this data type supports. Here are the eight (8) Primitive types that Java defines. Data Type Description Size Default Value Range Byte Byte Length Integer 8 bit 0 -128 to +127 signed Short Short Integer 16 bit 0 -32768 to +32767 Int Integer (number) 32 bit 0 -2,147,483,648 to 2,147,484 Long Long Integer 64 bit 0L -263 to 263-1 Float Single Precision Floating Point 32 bit 0.0f +1-about 1039 Double Double-Precision Floating Point 64 bit 0.0d 1-about 10317 Char A simple character 8 bit \u0000 0 to 65535 Boolean A Boolean (true or false) 1 bit false - Table 1. Data types Integer Types Java defines Byte, Short, Int, and Long as Integer data types. Since Java does not support unsigned integers, these four (4) are signed, positive, and negative values. Java does not support unsigned integers as these are mostly used to specify the behaviors of the high-order-bit. High-order bit defines the sign of an integer value, and Java manages it differently by adding a special “unsigned right shift” operation. a. Byte: The smallest integer type that represents a small number. It is used to declare a variable holding a natural number between -128 and 127. Byte variables are declared by use of the byte keyword. Syntax: byte b; b. Short: An integer is considered Short if its value is between -32768 and 32767. Short data types declare a variable that can hold numbers in that range. Syntax: short a; For example: public class ShortSample { public static void main(String[] args){ short total_stu = 1192; System.out.println("The total number of students are " + total_stu); } } A hexadecimal number can also be initialized as a Short variable instead of a normal decimal integer. So, the 3001 integer can be written as 0x4A8. 0x is used in Java to represent hexadecimal. 03 Handout 1 *Property of STI  [email protected] Page 1 of 6 IT2402 c. Int: This data type can handle larger numbers and is considered the best choice when an integer is needed because when Byte and Short values are used in an expression, they are promoted to Int automatically. For example: public class IntSample { public static void main(String[]args) { int days = 279; System.out.println("The days are " + days); } } d. Long: This data type holds a number higher than a regular integer. The Long integer is a variable that can hold a very large number. A capital letter ‘L’ is placed right after the value. For example: public class LongSample { public static void main(String[] args) { long distance = 84564L; System.out.println("The distance is " + distance); } } Floating Point Types Floating points are also called “real numbers”, and are used when evaluating an expression that needs fractional accuracy such as the computation of square root or a transcendental (sine and cosine). Float and Double are both floating-point types. a. Float is described as a single precision floating point. A real number qualifies as a single precession when it only needs a limited number of bits. Single precision takes half the space of a double precision and is much faster on some processors. Floats are used to represent dollars and cents, so a small letter ‘f’ is placed to the right of the value when initializing the variable. For example: public class FloatSample { public static void main(String[] args) { float pi = 3.14f; System.out.println("The value of pi is " + pi); } } b. Double: Double precision can be faster than single precision on modern processors that have been optimized for high-speed mathematical calculations. It can handle larger numbers than Float. For example: public class DoubleSample { public static void main(String[] args) { double pi = 3.141590; // a d/D suffix is optional. System.out.println(pi); } } 03 Handout 1 *Property of STI  [email protected] Page 2 of 6 IT2402 Character Types Character types can be divided into two (2): (a) A Byte for a character (ASCII) and (b) a type in itself (Unicode). a. A character is recognized by its ASCII (American Standard Code for Information Interchange – a code that assigns numbers to letters, digits, etc.) number. It allows Byte data types to be used to declare a variable that would hold a single character to initialize such variable or assign a single quoted character. For example: public class CharByte { public static void main(String[] arg) { byte Gender = 'F'; System.out.println("Gender is " + Gender); } } b. To support characters that are not traditionally used in (US) English and do not work with compilers, the Unicode character format was created which includes Latin-based and non-Latin-based languages. The Char data type was created to support Unicode characters in Java. To initialize, assign the character variable in single quotes. For example: public class CharUnicode{ public static void main(String a[]) { char gender ='f'; System.out.println("Gender is " + gender); } } Boolean This data type is used for logical values and can only hold true or false values. It is a type returned by all relational operators such as =, >, and 𝑥>𝑦 right operand Evaluates whether the left operand is less than the right Less Than < 𝑥= 𝑥 >= 𝑦 Equal to equal to the right operand Less Than or Equal Evaluates whether the left operand is less than or equal 𝑥=9≫2 number specified as the value for the second operand. 04 Handout 1 *Property of STI  [email protected] Page 2 of 5 IT2402 Left Shift >> 𝑥 = −10 ≫> 3 Shift replaces the bits that are shifted. Table 6. Shift operators. Zeros (0) are used as fillings when shifting in whichever direction. Shifting Positive Numbers The int data type occupies four (4) bytes in the memory. The rightmost eight bits of the number 9 are represented in binary as: 0 0 0 0 1 0 0 1 For the right shift, the bits of the left operand are shifted right. Using 𝑥 = 9 ≫ 2, the result becomes 2: 0 0 0 0 0 0 1 0 For the left shift, the bits of the left operand are shifted left. Using 𝑥 = 9 ≪ 2, the result becomes 40: 0 0 1 0 1 0 0 0 Bitwise Operators Compared to previous operators, bitwise operators perform operations bit-by-bit. These operators can be applied to byte, int, short, long, and char data types. Name Operator Description Example AND results in a 1 if both the bits are 1. Any other AND & 𝑥&𝑦 combination results in 0. OR results in a 0 when both the bits are 0. Any other OR | 𝑥|𝑦 combination results in 1. XOR results in a 0, if both the bits are of the same value XOR ^ 𝑥^𝑦 and 1 if the bits have different values. Inversion ~ Converts all 1 bits to 0’s and all 0 bits to 1’s ~𝑥 Table 7. Bitwise operators. When used with Boolean, x and y are integers and can be replaced with expressions that give a true or false result such as when both the expressions evaluate to true, the result of using & is true. Otherwise, false. Logical Operators These are used to combine the results of Boolean expressions. These operators share a likeness with bitwise operators, but logical operators are limited to Boolean expressions only. Name Operator Description Example Logical If both the operands are non-zero, the expression && 𝑥 > 4&&𝑦 < 8 AND returns true; otherwise, it returns false. If one or both the operands are non-zero, the expression Logical OR || 𝑥 > 4||𝑦 < 8 returns true; otherwise, it returns FALSE. Table 8. Logical operators. For the example of Logical AND, the result is true if the first condition (x>4) and the second condition (y>8) are both true. If any of the conditions are false, the result is false. 04 Handout 1 *Property of STI  [email protected] Page 3 of 5 IT2402 Conditional Operator This operator is used to control the flow of the program. The ternary operator is used mainly in loop statements. Name Operator Description Example (condition)? Evaluates val1 if the condition returns true and val2 Ternary 𝑥 = (𝑦 > 𝑧)? 𝑦: 𝑧 val1:val2 if the condition returns false. Table 9. Conditional operators. To explain the example, x is assigned the value of y if it is greater than z; otherwise, x is assigned the value of z. Order of Precedence of Operators Order of Precedence shows the hierarchy wherein an operation with high precedence is performed before the others. The table shows those with the same level of precedence are listed in the same row. Category Operators High Precedence [], () Unary +, -, ~, !, ++, -- Multiplicative *, /, % Additive +, - Shift , >>> Relational Equality =, ==, != Bitwise &, ^, | Logical &&, || Conditional ?: Assignment =, +=, -=, *=, !=, %= Table 10. Order of precedence. Expressions (Agarwal & Bansal, 2023) An expression is a combination of variables, constants, literals, and operators to produce a single value. A simple 23 + 16 and x = -82 are considered expressions. In Java, an expression statement consists of an expression followed by a semicolon (;) to evaluate an expression and disregard the result. int a = 10; System.out.println("The value of a is " + a); Each line in this code snippet is considered an expression statement. Here are several types of expressions in Java. Arithmetic Expression It is an expression that returns a numeric value based on the operators and operands used. For example: int x = 10; The last line is an arithmetic expression. It adds the value of x and y and int y = 15; int z = x + y; assigns the result to the z. 04 Handout 1 *Property of STI  [email protected] Page 4 of 5 IT2402 Assignment Expression It is an expression that involves assigning a value to a variable. For example: int a = 8; The last line is an assignment expression that adds 4 to the value of a and a = a + 4; assigns the result back to a. Relational Expression It is an expression that compares values using relational operators. For example: int x = 6; The last line is a relation expression comparing the values of x and y and int y = 8; boolean result = x < y; assigning the result to the variable result. Logical Expression It is an expression involving logical operators. For example: int j = 5; The last line is a logical expression that checks whether j is less int k = 4; than k and whether k is less than 4. The result is assigned to the boolean result = (j

Use Quizgecko on...
Browser
Browser