Forman Christian College, Lahore (university status)
Programming 1
COMPUTER S COMP 102

Spring 2016
Practice Question
Omar Khan / Atif Alvi
October 1, 2016
1
Chapter 1
Loops
1.1
While Loop
Iterating through a string
1. Print the first 10 integers
Solution:
1
2
3
4
5
6
i = 0
n = 10
while i < n :
prin
Forman Christian College, Lahore (university status)
Programming 1
COMPUTER S COMP 102

Spring 2016
While Loop
COMP 102
Structure and Interpretation of
Computer Programs
Omer Khan, Atif Alvi
Lecture 4
September 07, 2016
September 08, 2016
Omer Khan, Atif Alvi
COMP 102 Structure and Interpretation of
Forman Christian College, Lahore (university status)
Programming 1
COMPUTER S COMP 102

Spring 2016
# Write the following two functions:
# A function named isOdd that takes an integer n as input and outputs
# True or False depending on whether is odd or not
# A function named isEven that takes an in
Forman Christian College, Lahore (university status)
Programming 1
COMPUTER S COMP 102

Spring 2016
P ROGRAMMING I
H ANDOUT
Function Evaluation
October 9, 2016
We will use the following terms throughout the current document.
Frame is a place where Python can store information. You can thing of this
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
www.ijraset.com
IC Value: 13.98
Volume 4 Issue V, May 2016
ISSN: 23219653
International Journal for Research in Applied Science & Engineering
Technology (IJRASET)
Performance Comparison of Cryptanaly
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Forman Christian College, Lahore
(A Chartered University)
Assignment 2
Due: Wednesday 20/7/2016 at the start of class
1. Five friends have access to a chat room. Is it possible to determine who is cha
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
FORMAN CHRISTIAN COLLEGE (A Chartered University)
Spring 2016
Discrete Mathematics (3 Credits Hrs)
Course Outline and Weekly Plan
Instructor Information:
Name
Umber Nisar
Email
[email protected]
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Forman Christian College, Lahore
(A Chartered University)
Assignment 1
Due: Wednesday 15/6/2016 at the start of class
1. Suppose the following two propositions are both False.
If the student has pass
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 5
Discrete Mathematics
Sets
Ordered ntuples
These are like sets, except that duplicates matter,
and the order makes a difference.
For nN, an ordered ntuple or a sequence or list
of length n
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 2
Discrete Mathematics
Propositional Equivalence
Propositional Equivalence
Two syntactically (i.e., textually) different compound propositions may
be the semantically identical (i.e., have the
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 4
Discrete Mathematics
Sets
SET
What is a set?
It's a collection
SET
First you specify a common property among "things" and
then you gather up all the "things" that have this common
property
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 3
Discrete Mathematics
Logic and Proof
Predicate Logic
Predicate logic is an extension of propositional
logic that permits concisely reasoning about
whole classes of entities.
Propositional
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 6
Discrete Mathematics
Functions
Functions
The concept of function is extremely important in discrete
mathematics as functions are used:
In definition of discrete structures like sequences an
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture
Discrete Mathematics
Algorithms
1
11/13/2015
An algorithm is a finite sequence of precise
instructions for performing a computation or for
solving a problem.
2
11/13/2015
Describe an algorith
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture
Discrete Mathematics
Algorithms
1
11/16/2015
An algorithm is a finite sequence of precise
instructions for performing a computation or for
solving a problem.
2
11/16/2015
Describe an algorith
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 1
Discrete Mathematics
Logic and Proof
Foundations of Logic
Mathematical Logic is a tool for working with elaborate compound
statements. It includes:
A formal language for expressing them.
A
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 7
Discrete Mathematics
Functions
OnetoOne Functions
A function is onetoone (11), or injective, or an
injection, iff f(x) = f(y) implies that x=y for all x and y
in domain of f.
In other
Forman Christian College, Lahore (university status)
Discrete Mathematics
COMPUTER S 113

Summer 2016
Lecture 8
Discrete Mathematics
Functions
Onto (Surjective) Functions
A function f:AB is onto or surjective or a surjection iff its
range is equal to its codomain (bB, aA: f(a)=b).
Think: An onto fun
Forman Christian College, Lahore (university status)
Programming 2
COMPUTER S CS111

Spring 2016
Pointer Practice Questions
Fakhir Shaheen
April 21, 2016
1
Iterating through arrays
1.1
Write a function having the following signature that returns the index of the element
having maximum value in an