This document provides an overview of conditional and iterative statements in Python. It begins by defining selection and iteration as two types of control structures that allow programs to control the flow of execution.
It then discusses conditional constructs like if/else statements, providing examples of how to write if/else and if/elif/else statements. It also covers loops, specifically while and for loops. The while loop repeats a block of code as long as a condition is true, and for loops iterate over a sequence. Examples are given of using range() and len() with for loops. Finally, the document lists several programming problems suited for different levels that involve conditional and iterative statements.
The document discusses for loops in Java including their syntax, examples of using for loops to print numbers, infinite loops, breaking and continuing loops, and nested for loops. It provides examples of using for loops to generate Fibonacci sequences, factorials, prime numbers, and nested patterns.
In this presentation slides you will able to understand easily ,this slides contain loops of c++ programming language which contain for loop , while loop , do while loop and nested these all are describe with definition,examples and flow charts
This document discusses interfaces in Java. It defines an interface as a blueprint of a class that defines static constants and abstract methods. Interfaces are used to achieve abstraction and multiple inheritance in Java. They represent an "is-a" relationship. There are three main reasons to use interfaces - for abstraction, to support multiple inheritance functionality, and to achieve loose coupling. The document provides examples of interfaces, such as a Printable interface and implementations in different classes. It also demonstrates multiple inheritance using interfaces and interface inheritance.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
1) A semaphore consists of a counter, a waiting list, and wait() and signal() methods. Wait() decrements the counter and blocks if it becomes negative, while signal() increments the counter and resumes a blocked process if the counter becomes positive.
2) The dining philosophers problem is solved using semaphores to lock access to shared chopsticks, with one philosopher designated as a "weirdo" to avoid deadlock by acquiring locks in a different order.
3) The producer-consumer problem uses three semaphores - one to limit buffer size, one for empty slots, and one for locks - to coordinate producers adding to a bounded buffer
This document presents an overview of priority scheduling algorithms. It discusses basic concepts of scheduling, criteria like CPU utilization and turnaround time. It provides an example of priority scheduling with and without preemption. Advantages include ease of use and suitability for varying time requirements. A disadvantage is potential indefinite blocking of low priority processes.
This document discusses various control flow statements in Java including branching statements, looping statements, and jump statements. It provides examples of if, if-else, if-else-if statements, switch statements, for loops, while loops, do-while loops, break, continue, and return statements. Key points include:
- Branching statements like if, if-else, if-else-if are used to control program flow based on boolean conditions. Switch statements provide an alternative for multiple if-else statements.
- Looping statements like for, while, do-while repeat a block of code while/until a condition is met.
- Jump statements like break and continue control flow within loops, while
The document discusses for loops in Java including their syntax, examples of using for loops to print numbers, infinite loops, breaking and continuing loops, and nested for loops. It provides examples of using for loops to generate Fibonacci sequences, factorials, prime numbers, and nested patterns.
In this presentation slides you will able to understand easily ,this slides contain loops of c++ programming language which contain for loop , while loop , do while loop and nested these all are describe with definition,examples and flow charts
This document discusses interfaces in Java. It defines an interface as a blueprint of a class that defines static constants and abstract methods. Interfaces are used to achieve abstraction and multiple inheritance in Java. They represent an "is-a" relationship. There are three main reasons to use interfaces - for abstraction, to support multiple inheritance functionality, and to achieve loose coupling. The document provides examples of interfaces, such as a Printable interface and implementations in different classes. It also demonstrates multiple inheritance using interfaces and interface inheritance.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
1) A semaphore consists of a counter, a waiting list, and wait() and signal() methods. Wait() decrements the counter and blocks if it becomes negative, while signal() increments the counter and resumes a blocked process if the counter becomes positive.
2) The dining philosophers problem is solved using semaphores to lock access to shared chopsticks, with one philosopher designated as a "weirdo" to avoid deadlock by acquiring locks in a different order.
3) The producer-consumer problem uses three semaphores - one to limit buffer size, one for empty slots, and one for locks - to coordinate producers adding to a bounded buffer
This document presents an overview of priority scheduling algorithms. It discusses basic concepts of scheduling, criteria like CPU utilization and turnaround time. It provides an example of priority scheduling with and without preemption. Advantages include ease of use and suitability for varying time requirements. A disadvantage is potential indefinite blocking of low priority processes.
This document discusses various control flow statements in Java including branching statements, looping statements, and jump statements. It provides examples of if, if-else, if-else-if statements, switch statements, for loops, while loops, do-while loops, break, continue, and return statements. Key points include:
- Branching statements like if, if-else, if-else-if are used to control program flow based on boolean conditions. Switch statements provide an alternative for multiple if-else statements.
- Looping statements like for, while, do-while repeat a block of code while/until a condition is met.
- Jump statements like break and continue control flow within loops, while
The final keyword in Java can be applied to variables, methods, and classes. It restricts changes to final entities. Final variables must be initialized after declaration and their values cannot be changed. Final methods cannot be overridden in subclasses. Final classes cannot be subclassed. Blank final variables are not initialized in their declaration and can only be initialized in a constructor or static block.
This document provides an overview of threads in Java, including:
- Threads allow for multitasking by executing multiple processes simultaneously. They are lightweight processes that exist within a process and share system resources.
- Threads can be created by extending the Thread class or implementing the Runnable interface. The run() method defines the code executed by the thread.
- Threads transition between states like new, runnable, running, blocked, and dead during their lifecycle. Methods like start(), sleep(), join(), etc. impact the thread states.
- Synchronization is used to control access to shared resources when multiple threads access methods and data outside their run() methods. This prevents issues like inconsistent data.
Loop(for, while, do while) condition PresentationBadrul Alam
This document discusses three types of loops in Java programming: for loops, while loops, and do-while loops. It provides the syntax, flow diagrams, and examples of each loop type. Additionally, it covers the break and continue statements that can be used within loops to alter their flow control, with examples of how each statement works.
This document discusses different types of loops in C programming. It describes while, for, do-while, and nested loops. While loops execute a block of code as long as a condition is true. For loops allow executing a block of code a specific number of times. Do-while loops are similar to while loops but execute the block at least once even if the condition is false. Nested loops allow a loop to be placed inside another loop to repeat a block of code multiple times.
This document discusses semaphores, which are integer variables that coordinate access to shared resources. It describes counting semaphores, which allow multiple processes to access a critical section simultaneously up to a set limit, and binary semaphores, which only permit one process at a time. Key differences are that counting semaphores can have any integer value while binary semaphores are limited to 0 or 1, and counting semaphores allow multiple slots while binary semaphores provide strict mutual exclusion. Limitations of semaphores include potential priority inversion issues and deadlocks if not used properly.
This document discusses deadlocks in operating systems. It defines a deadlock as when a set of processes are blocked because each process is holding a resource and waiting for another resource held by another process. Four conditions must be met simultaneously for a deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. An example of a deadlock between two processes, Process 1 and Process 2, is provided. Methods for handling deadlocks include prevention/avoidance, detection and recovery, and ignoring the problem. Prevention negates one of the necessary conditions, while avoidance uses strategies like Banker's algorithm to ensure deadlocks are avoided.
The non-access modifiers in Java include static, final, abstract, synchronized, transient, and volatile. Static can be used for variables and methods and creates elements that exist independently of any class instances. Final can also be used for variables, methods, and classes and prevents reassignment, overriding, or subclassing. Synchronized ensures only one thread can access a method at a time. Transient skips serialization for variables. Volatile ensures updates to a variable are visible across threads.
Iteration statements allow code to be repeated based on a condition. The main types of iteration statements are:
1) For loops iterate based on a initialization, condition, and post-iteration expression. They are commonly used when the number of iterations is known.
2) While loops iterate as long as a condition is true. The condition is checked at the start of each iteration.
3) Do-while loops are similar to while loops but execute the code block once before checking the condition, so the code is always run at least once.
This document discusses multithreading in Java. It defines a thread as the smallest unit of processing and explains that multithreading allows executing multiple threads simultaneously by sharing memory. It provides examples of creating threads by extending the Thread class and implementing the Runnable interface. It also describes synchronization, inter-thread communication using wait(), notify(), notifyAll() methods, and the join() method.
Data abstraction is the process of hiding certain details and showing only essential information to the user.
Interfaces and Abstract classes.
Contains abstract keyword also.
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
The document discusses Java AWT (Abstract Window Toolkit). It describes that AWT is an API that allows developing GUI applications in Java. It provides classes like TextField, Label, TextArea etc. for building GUI components. The document then explains key AWT concepts like containers, windows, panels, events, event handling model, working with colors and fonts.
An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map.
Each activity is given a window in which to draw its user interface. The window typically fills the screen, but may be smaller than the screen and float on top of other windows.
An application usually consists of multiple activities that are loosely bound to each other. Typically, one activity in an application is specified as the "main" activity, which is presented to the user when launching the application for the first time. Each activity can then start another activity in order to perform different actions.
Each time a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack .
When a new activity starts, it is pushed onto the back stack and takes user focus.
The document discusses multithreading and threading concepts in Java. It defines a thread as a single sequential flow of execution within a program. Multithreading allows executing multiple threads simultaneously by sharing the resources of a process. The key benefits of multithreading include proper utilization of resources, decreased maintenance costs, and improved performance of complex applications. Threads have various states like new, runnable, running, blocked, and dead during their lifecycle. The document also explains different threading methods like start(), run(), sleep(), yield(), join(), wait(), notify() etc and synchronization techniques in multithreading.
This document discusses deadlocks, including the four conditions required for a deadlock, methods to avoid deadlocks like using safe states and Banker's Algorithm, ways to detect deadlocks using wait-for graphs and detection algorithms, and approaches to recover from deadlocks such as terminating processes or preempting resources.
The document discusses different types of loops and conditional statements in programming languages. It explains the if, if-else, and switch conditional statements, providing examples of each. It also covers different types of loops - while, do-while, for, and nested loops. Examples are given to illustrate the syntax and usage of each loop and conditional statement.
Chapter 9 Conditional and Iterative Statements.pptxmaheshnanda14
This document discusses conditional and iterative statements in Python. It begins by introducing control structures like selection and iteration that allow controlling the flow of a program. The main types of control structures covered are sequences, conditionals (if/else), and loops (while and for). Several examples of using conditional (if/else) and iterative (while, for) statements are provided, along with explanations and flowcharts. Common looping constructs like break, continue, pass, and range are also described. The document concludes with a class test as practice problems.
The final keyword in Java can be applied to variables, methods, and classes. It restricts changes to final entities. Final variables must be initialized after declaration and their values cannot be changed. Final methods cannot be overridden in subclasses. Final classes cannot be subclassed. Blank final variables are not initialized in their declaration and can only be initialized in a constructor or static block.
This document provides an overview of threads in Java, including:
- Threads allow for multitasking by executing multiple processes simultaneously. They are lightweight processes that exist within a process and share system resources.
- Threads can be created by extending the Thread class or implementing the Runnable interface. The run() method defines the code executed by the thread.
- Threads transition between states like new, runnable, running, blocked, and dead during their lifecycle. Methods like start(), sleep(), join(), etc. impact the thread states.
- Synchronization is used to control access to shared resources when multiple threads access methods and data outside their run() methods. This prevents issues like inconsistent data.
Loop(for, while, do while) condition PresentationBadrul Alam
This document discusses three types of loops in Java programming: for loops, while loops, and do-while loops. It provides the syntax, flow diagrams, and examples of each loop type. Additionally, it covers the break and continue statements that can be used within loops to alter their flow control, with examples of how each statement works.
This document discusses different types of loops in C programming. It describes while, for, do-while, and nested loops. While loops execute a block of code as long as a condition is true. For loops allow executing a block of code a specific number of times. Do-while loops are similar to while loops but execute the block at least once even if the condition is false. Nested loops allow a loop to be placed inside another loop to repeat a block of code multiple times.
This document discusses semaphores, which are integer variables that coordinate access to shared resources. It describes counting semaphores, which allow multiple processes to access a critical section simultaneously up to a set limit, and binary semaphores, which only permit one process at a time. Key differences are that counting semaphores can have any integer value while binary semaphores are limited to 0 or 1, and counting semaphores allow multiple slots while binary semaphores provide strict mutual exclusion. Limitations of semaphores include potential priority inversion issues and deadlocks if not used properly.
This document discusses deadlocks in operating systems. It defines a deadlock as when a set of processes are blocked because each process is holding a resource and waiting for another resource held by another process. Four conditions must be met simultaneously for a deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. An example of a deadlock between two processes, Process 1 and Process 2, is provided. Methods for handling deadlocks include prevention/avoidance, detection and recovery, and ignoring the problem. Prevention negates one of the necessary conditions, while avoidance uses strategies like Banker's algorithm to ensure deadlocks are avoided.
The non-access modifiers in Java include static, final, abstract, synchronized, transient, and volatile. Static can be used for variables and methods and creates elements that exist independently of any class instances. Final can also be used for variables, methods, and classes and prevents reassignment, overriding, or subclassing. Synchronized ensures only one thread can access a method at a time. Transient skips serialization for variables. Volatile ensures updates to a variable are visible across threads.
Iteration statements allow code to be repeated based on a condition. The main types of iteration statements are:
1) For loops iterate based on a initialization, condition, and post-iteration expression. They are commonly used when the number of iterations is known.
2) While loops iterate as long as a condition is true. The condition is checked at the start of each iteration.
3) Do-while loops are similar to while loops but execute the code block once before checking the condition, so the code is always run at least once.
This document discusses multithreading in Java. It defines a thread as the smallest unit of processing and explains that multithreading allows executing multiple threads simultaneously by sharing memory. It provides examples of creating threads by extending the Thread class and implementing the Runnable interface. It also describes synchronization, inter-thread communication using wait(), notify(), notifyAll() methods, and the join() method.
Data abstraction is the process of hiding certain details and showing only essential information to the user.
Interfaces and Abstract classes.
Contains abstract keyword also.
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
The document discusses Java AWT (Abstract Window Toolkit). It describes that AWT is an API that allows developing GUI applications in Java. It provides classes like TextField, Label, TextArea etc. for building GUI components. The document then explains key AWT concepts like containers, windows, panels, events, event handling model, working with colors and fonts.
An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map.
Each activity is given a window in which to draw its user interface. The window typically fills the screen, but may be smaller than the screen and float on top of other windows.
An application usually consists of multiple activities that are loosely bound to each other. Typically, one activity in an application is specified as the "main" activity, which is presented to the user when launching the application for the first time. Each activity can then start another activity in order to perform different actions.
Each time a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack .
When a new activity starts, it is pushed onto the back stack and takes user focus.
The document discusses multithreading and threading concepts in Java. It defines a thread as a single sequential flow of execution within a program. Multithreading allows executing multiple threads simultaneously by sharing the resources of a process. The key benefits of multithreading include proper utilization of resources, decreased maintenance costs, and improved performance of complex applications. Threads have various states like new, runnable, running, blocked, and dead during their lifecycle. The document also explains different threading methods like start(), run(), sleep(), yield(), join(), wait(), notify() etc and synchronization techniques in multithreading.
This document discusses deadlocks, including the four conditions required for a deadlock, methods to avoid deadlocks like using safe states and Banker's Algorithm, ways to detect deadlocks using wait-for graphs and detection algorithms, and approaches to recover from deadlocks such as terminating processes or preempting resources.
The document discusses different types of loops and conditional statements in programming languages. It explains the if, if-else, and switch conditional statements, providing examples of each. It also covers different types of loops - while, do-while, for, and nested loops. Examples are given to illustrate the syntax and usage of each loop and conditional statement.
Chapter 9 Conditional and Iterative Statements.pptxmaheshnanda14
This document discusses conditional and iterative statements in Python. It begins by introducing control structures like selection and iteration that allow controlling the flow of a program. The main types of control structures covered are sequences, conditionals (if/else), and loops (while and for). Several examples of using conditional (if/else) and iterative (while, for) statements are provided, along with explanations and flowcharts. Common looping constructs like break, continue, pass, and range are also described. The document concludes with a class test as practice problems.
Python Programming - III. Controlling the FlowRanel Padon
This document discusses controlling program flow in Python programming. It covers sequence, selection, and repetition control structures including if/else statements, while loops, for loops, and nested control structures. Examples of pseudocode and Python code are provided to illustrate different control structures. The document also discusses logical operators, augmented assignment operators, and practice exercises for readers to test their understanding of controlling program flow.
This document discusses control flow in Python programming. It covers the three types of control flow: sequential, conditional, and iterative execution. Conditional execution uses if, if-else, elif statements to control the flow based on conditions. Iterative execution uses while and for loops to repeatedly execute code. The while loop runs until a condition is false, and the for loop iterates a specific number of times. Break and continue statements can alter the normal flow inside loops. Examples are provided for each control structure. The document concludes with assignments related to control flow concepts in Python.
265 ge8151 problem solving and python programming - 2 marks with answersvithyanila
The document provides sample questions and answers related to problem solving and Python programming. It includes 20 multiple choice questions covering topics like algorithms, pseudo code, flowcharts, recursion, and more. An algorithm is provided to find the minimum of 3 numbers in a list. The key building blocks of an algorithm are also defined as statements, sequence, selection, repetition, and functions.
The document discusses Python control structures including if-else statements, indentation, and loops. It provides examples of if statements, if-else statements, nested if statements, and elif statements to test conditions and execute code blocks accordingly. It also discusses for loops and the range() function to iterate through sequences and generate number sequences to repeat code. Loops simplify problems by allowing code to repeat without rewriting and help traverse data structures.
Fundamentals of Programming Lecture #1.pptxEyasu46
This document provides an overview of programming and problem solving concepts. It discusses that a problem is a situation that needs resolution, while a solution removes the problematic situation. Problem solving is the process of deriving a solution. Programming involves creating computer solutions to problems through algorithms expressed as programs. Key steps for problem solving are understanding the problem, planning an algorithm/solution, implementing it as a program, testing the program, documenting it, and maintaining it for changes. Pseudocode and flowcharts are common ways to describe algorithms before implementing them as programs.
Python uses indentation to define code blocks for decision making statements like if, elif and else. The if statement executes code if a condition is true, elif allows checking multiple conditions, and else runs code if all conditions are false. Loops like while and for repeat code, with while looping until a condition is false and for iterating over a sequence. Nested loops can run inner loops multiple times during outer loop iterations. The else block after a for runs if all iterations complete without breaking from the loop.
This document discusses different types of flow control in Python programs. It explains that a program's control flow defines the order of execution and can be altered using control flow statements. There are three main types of control flow: sequential, conditional/selection, and iterative/looping.
Sequential flow executes code lines in order. Conditional/selection statements like if/else allow decisions based on conditions. Iterative/looping statements like for and while loops repeat code for a set number of iterations or as long as a condition is true. Specific conditional statements, loops, and examples are described in more detail.
The document provides an overview of the C programming language, including its history, uses, basic syntax, data types, variables, operators, decision making structures, loops, functions, and other common features. It begins with an introduction to C and discusses setting up the development environment. It then covers the basic structure of C programs and many fundamental aspects of the language like tokens, comments, identifiers, keywords and basic syntax rules.
This document provides an overview of Python programming concepts including what Python is, variables, data types, operators, conditional statements, loops, functions, exceptions, lists, dictionaries, tuples and more. Some key points covered include:
- Python is an interpreted, object-oriented programming language that can be used for many different application types.
- Variables, constants, operators, and control flow structures like conditionals and loops are introduced as the basic building blocks of Python programs.
- Common data types like strings, lists, dictionaries and tuples are described along with their characteristics and functions.
- Other concepts explained are functions, exceptions, formatting, modules and more.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
The document provides information about a course on Object Oriented Programming concepts in Python. It outlines 6 course outcomes related to illustrating Python basics, developing scripts using control statements and data types, constructing object oriented programs using functions, and applying concepts like inheritance, polymorphism, and exception handling. It also mentions the syllabus, books and references, and provides introductory information about Python including its history, uses, installation process, interpreted nature, and basic programming concepts.
Looping Statements and Control Statements in PythonPriyankaC44
This document discusses looping statements and control statements in Python. It explains while loops, for loops, and the use of break, continue, else and pass statements. Some key points:
- While loops repeatedly execute statements as long as a condition is true. For loops iterate over a sequence.
- Break and continue statements can alter loop flow - break exits the entire loop, continue skips to the next iteration.
- The else block in loops runs when the condition becomes false (while) or the sequence is complete (for).
- Pass is a null operation used when syntax requires a statement but no operation is needed.
Several examples of loops and control statements are provided to demonstrate their usage.
C has emerged as the most widely used programming language due to its features that allow for well-structured programs and efficient code. It was originally developed in the 1970s at Bell Labs to rewrite the Unix operating system. C programs consist of functions, variables, operators, and control structures like conditionals and loops to perform tasks. Common operations include input/output, arithmetic, comparisons, and manipulating data types like integers, floats, characters, and strings.
C has emerged as the most widely used programming language due to its features that allow for well-structured programs and efficient code. It was originally developed in the 1970s at Bell Labs to rewrite the Unix operating system. C programs consist of functions, variables, operators, and control structures like conditionals and loops to perform tasks. Common operations include input/output, arithmetic, comparisons, and manipulating data types like integers, floats, characters, and strings.
This document provides information about loop statements in programming. It discusses the different parts of a loop, types of loops including while, for, and do-while loops. It also covers nested loops and jump statements like break and continue. Examples are given for each loop type. The document concludes with multiple choice and program-based questions as exercises.
Helpmeinhomework Experts provides the most trusted and reliable online Programming assignment help . Programming is one of the most widely taught subjects across the universities. The complexity of subjects make students seek for quality and affordable online guidance. We at helpmeinhomework.com Experts cater to such needs of the students. Our programming experts provide assignment help to students across UK, USA and Australia for multiple programming languages i.e. Java, Python, HTML, PHP, Assembly language, C ,Linux ,Unix etc.
Similar to Chapter 9 Conditional and Iterative Statements.pptx (20)
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...APNIC
Adli Wahid, Senior Internet Security Specialist at APNIC, delivered a presentation titled 'Honeypots Unveiled: Proactive Defense Tactics for Cyber Security' at the Phoenix Summit held in Dhaka, Bangladesh from 23 to 24 May 2024.
Discover the benefits of outsourcing SEO to Indiadavidjhones387
"Discover the benefits of outsourcing SEO to India! From cost-effective services and expert professionals to round-the-clock work advantages, learn how your business can achieve digital success with Indian SEO solutions.
Securing BGP: Operational Strategies and Best Practices for Network Defenders...APNIC
Md. Zobair Khan,
Network Analyst and Technical Trainer at APNIC, presented 'Securing BGP: Operational Strategies and Best Practices for Network Defenders' at the Phoenix Summit held in Dhaka, Bangladesh from 23 to 24 May 2024.
HijackLoader Evolution: Interactive Process HollowingDonato Onofri
CrowdStrike researchers have identified a HijackLoader (aka IDAT Loader) sample that employs sophisticated evasion techniques to enhance the complexity of the threat. HijackLoader, an increasingly popular tool among adversaries for deploying additional payloads and tooling, continues to evolve as its developers experiment and enhance its capabilities.
In their analysis of a recent HijackLoader sample, CrowdStrike researchers discovered new techniques designed to increase the defense evasion capabilities of the loader. The malware developer used a standard process hollowing technique coupled with an additional trigger that was activated by the parent process writing to a pipe. This new approach, called "Interactive Process Hollowing", has the potential to make defense evasion stealthier.
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!Alec Kassir cozmozone
The contemporary hospital setting is witnessing a growing convergence between physical security and cybersecurity. Because of advancements in technology and the rise in cyberattacks, healthcare facilities face unique challenges.
6. LEARNING OUTCOMES
After studying this lesson, students will be able to:
Understand the concept and usage of selection
and iteration statements.
Know various types of loops available in Python.
Analyze the problem, decide and evaluate
conditions.
7. LEARNING OUTCOMES
After studying this lesson, students will be able to:
Will be able to analyze and decide for an
appropriate combination of constructs.
Write code that employ decision structures,
including those that employ sequences of decision
and nested decisions.
Design simple applications having iterative
nature.
9. INTRODUCTION
Programs are written for the solution to
the real world problems. A language should
have the ability to control the flow of execution
so that at different intervals different
statements can be executed. Structured
programming is a paradigm aims at controlling
the flow of execution of statements in a
program by using control structures.
A language which supports the control
structures is called as structured programming
language
11. A Structured programming is an important
feature of a programming language which
comprises following logical structure:
1. SEQUENCE
2. SELECTION
3. ITERATION OR LOOPING
4. BRANCHING OR JUMPING STATEMENTS
TYPES OF CONTROL STRUCTURES
12. Sequence is the default control structure;
instructions are executed one after another.
Statement 1
Statement 2
Statement 3
……..
……..
……..
1. SEQUENCE
16. Sequence is the default control structure;
instructions are executed one after another.
# This program adds two numbers
def sum_of_two_no():
num1 = 1.5
num2 = 6.3
sum = float(num1) + float(num2)
print('The sum is =‘, sum)
sum_of_two_no():
1. SEQUENCE - PROGRAM
18. A selection statement causes the
program control to be transferred to a
specific flow based upon whether a certain
condition is true or not.
2. SELECTION
20. CONDITIONAL CONSTRUCT – if else STATEMENT
Conditional constructs (also known as if
statements) provide a way to execute a chosen
block of code based on the run-time evaluation of
one or more Boolean expressions. In Python, the
most general form of a conditional is written as
follows:
Contd.. Next Slide
21. CONDITIONAL CONSTRUCT – if else STATEMENT
if first condition:
first body
elif second condition:
second body
elif third condition:
third body
else:
fourth body
: Colon Must
23. CONDITIONAL CONSTRUCT – if else STATEMENT
FLOW CHART
Condition ? Statement 1 Statement 2
Statement 1
Statement 2
False
True
else
body
Main
Body
24. CONDITIONAL CONSTRUCT – if else STATEMENT
Each condition is a Boolean expression, and
each body contains one or more commands that
are to be executed conditionally.
If the first condition succeeds, the first body will
be executed; no other conditions or bodies are
evaluated in that case.
25. CONDITIONAL CONSTRUCT – if else STATEMENT
If the first condition fails, then the process
continues in similar manner with the evaluation
of the second condition. The execution of this
overall construct will cause precisely one of the
bodies to be executed.
There may be any number of elif clauses
(including zero), and
The final else clause is optional.
33. PROGRAM LIST ON if CONTSTUCT
1. Write a PYTHON program that reads a value of
n and check the number is zero or non zero value.
2. Write a PYTHON program to find a largest of
two numbers.
3. Write a PYTHON program that reads the
number and check the no is positive or negative.
4. Write a PYTHON program to check entered
character is vowel or consonant.
BELOW AVERAGE PROGRAMS
34. PROGRAM LIST ON if CONTSTUCT
5. Write a PYTHON program to evaluate the
student performance
If % is >=90 then Excellent performance
If % is >=80 then Very Good performance
If % is >=70 then Good performance
If % is >=60 then average performance
else Poor performance.
6. Write a PYTHON program to find largest of
three numbers.
7. Write a PYTHON program to find smallest of
three numbers
AVERAGE PROGRAMS
35. PROGRAM LIST ON if CONTSTUCT
8.Write a PYTHON program to check weather
number is even or odd.
9.Write a PYTHON program to check a year for
leap year.
10. A company insures its drivers in the following
cases:
- If the driver is married.
- If the driver is unmarried, male and above 30
years of age.
- If the driver is unmarried, female and above 25
years of age.
ABOVE AVERAGE PROGRAMS
36. PROGRAM LIST ON if CONTSTUCT
In all the other cases, the driver is not insured.
If the marital status, sex and age of the driver are
the inputs,
Write a PYTHON program to determine
whether the driver is insured or not
***
ABOVE AVERAGE PROGRAMS
38. 3. ITERATION OR LOOPING
What is loop or iteration?
Loops can execute a block of code number
of times until a certain condition is met.
OR
The iteration statement allows instructions to
be executed until a certain condition is to be
fulfilled.
The iteration statements are also called as
loops or Looping statements.
39. 3. ITERATION OR LOOPING
Python provides two kinds of loops &
they are,
for loop
while loop
41. while loop
A while loop allows general repetition
based upon the repeated testing of a Boolean
condition
The syntax for a while loop in Python is as
follows:
while condition:
body
Where, loop body contain the single
statement or set of statements (compound
statement) or an empty statement.
Contd..
: Colon Must
42. while loop
The loop iterates while the expression
evaluates to true, when expression becomes
false the loop terminates.
while loop
FLOW CHART
49. while loop - programs
1. Write a PYTHON program to print the natural
numbers up to n
2. Write a PYTHON program to print even
numbers up to n
3. Write a PYTHON program to print odd
numbers up to n
4. Write a PYTHON program to print sum of
natural numbers up to n
BELOW AVERAGE PROGRAMS
50. while loop - programs
5. Write a PYTHON program to print sum of odd
numbers up to n
6. Write a PYTHON program to print sum of even
numbers up to n
7. Write a PYTHON program to print natural
numbers up to n in reverse order.
8. Write a PYTHON program to print Fibonacci
series up to n
9. Write a PYTHON program find a factorial of
given number
AVERAGE PROGRAMS
51. while loop - programs
10. Write a PYTHON program to check the
entered number is prime or not
11. Write a PYTHON program to find the sum of
digits of given number
12. Write a PYTHON program to check the
entered number is palindrome or not
13. Write a PYTHON program to reverse the given
number.
ABOVE AVERAGE & HOTS PROGRAMS
52. while loop - programs
14. Write a PYTHON program to print the
multiplication table
15. Write a PYTHON program to print the largest
of n numbers
16. Write a PYTHON program to print smallest of
n numbers
ABOVE AVERAGE & HOTS PROGRAMS
54. for LOOP
Python’s for-loop syntax is a more
convenient alternative to a while loop when
iterating through a series of elements. The for-
loop syntax can be used on any type of iterable
structure, such as a list, tuple str, set, dict, or
file
Syntax or general format of for loop is,
for element in iterable:
body
55. for LOOP
Python’s for-loop syntax is a more
convenient alternative to a while loop when
iterating through a series of elements. The for-
loop syntax can be used on any type of iterable
structure, such as a list, tuple str, set, dict, or
file
Syntax or general format of for loop is,
for element in iterable:
body
58. for LOOP - range KEYWORD
The range() function returns a
sequence of numbers, starting from 0 by
default, and increments by 1 (by default),
and ends at a specified number.
range(start, stop, step)
for n in range(3,6):
print(n)
x = range(3, 6)
for n in x:
print(n)
OR
59. for LOOP - range KEYWORD
OUTPUT
#Generating series of numbers
60. for LOOP - range KEYWORD
OUTPUT
#Generating even numbers
64. else statement in loop
else can be used in for and while loops
the else body will be executed as and when the
loop’s conditional expression evaluates to false
OUTPUT
66. for loop – Programs - Class work / Home Work
1. Write a PYTHON program to print the natural
numbers up to n
2. Write a PYTHON program to print even numbers
up to n
3. Write a PYTHON program to print odd numbers
up to n
4. Write a PYTHON program that prints 1 2 4 8
16 32 … n2
5. Write a PYTHON program to sum the given
sequence
1 + 1/ 1! + 1/ 2! + 1/3! + …. + 1/n!
BELLOW AVERAGE PROGRAMS
67. for loop – Programs - Class work / Home Work
6. Write a PYTHON program to compute the cosine
series
cos(x) = 1 – x2 / 2! + x4 / 4! – x6 / 6! + … xn / n!
7. Write a short PYTHON program to check weather
the square root of number is prime or not.
8. Write a PYTHON program to produce following
design
A B C
A B C
A B C
AVERAGE PROGRAMS
68. for loop – Programs - Class work / Home Work
9. Write a PYTHON program to produce following
design
A
A B
A B C
A B C D
A B C D E
If user enters n value as 5
ABOVE AVERAGE PROGRAMS
69. for loop – Programs - Class work / Home Work
10. Write a PYTHON program to produce following
design
A B C D E
A B C D
A B C
A B
A
(If user enters n value as 5)
ABOVE AVERAGE PROGRAMS
70. for loop – Programs - Class work / Home Work
11. Write a PYTHON program to produce
following design
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
If user enters n value as 5
ABOVE AVERAGE PROGRAMS
71. for loop – Programs - Class work / Home Work
12. Write a PYTHON program to produce
following design
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
If user enters n value as 5
ABOVE AVERAGE PROGRAMS
73. 4. BRANCHING OR JUMPING STATEMENTS
Python has an unconditional branching
statements and they are,
1. break STATEMENT
2. continue STATEMENT
74. 4. BRANCHING OR JUMPING STATEMENTS
1. break STATEMENT
Break can be used to unconditionally
jump out of the loop. It terminates the
execution of the loop. Break can be used in
while loop and for loop. Break is mostly
required, when because of some external
condition, we need to exit from a loop.
77. 2. continue STATEMENT
The continue statement in
Python returns the control to the
beginning of the while loop. The continue
statement rejects all the
remaining statements in the current
iteration of the loop and moves the
control back to the top of the loop.
The continue statement can be used in
both while and for loops.
79. 2. continue STATEMENT
when i value becomes 2 the print statement gets
skipped, continue statement goes for next iteration,
hence in the out put 2 is not printed
81. pass STATEMENT
The pass statement in Python is used when a
statement is required syntactically but you do not
want any command or code to execute.
The pass statement is a null operation; nothing
happens when it executes.
The pass is also useful in places where your
code will eventually go, but has not been written
yet (e.g., in stubs for example):
84. Difference Between break and continue
BREAK CONTINUE
It terminates the execution
of remaining iteration of
the loop.
It terminates only the current
iteration of the loop.
'break' resumes the control
of the program to the end
of loop enclosing that
'break'.
'continue' resumes the control
of the program to the next
iteration of that loop enclosing
'continue'.
It causes early termination
of loop.
It causes early execution of
the next iteration.
'break' stops the
continuation of loop.
'continue' do not stops the
continuation of loop, it only
stops the current iteration.
86. CLASS TEST
Time: 40 Min Max Marks: 20
1. Explain the types control structures 05
2. Write a program to check number is prime or
not 05
3. Write a program to check the entered number
is Armstrong number or not 05
4. Differentiate between break and continue 05