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 :
print ( i )
i = i + 1
print ()
2. Print the first 10 intege
Forman Christian College, Lahore (university status)
Programming 1
COMPUTER S COMP 102

Spring 2016
Strings
COMP 102
Structure and Interpretation of Computer
Programs
Omar Khan / Atif Alvi
Lecture 8
September 28/29, 2016
Omar Khan / Atif Alvi
COMP 102 Structure and Interpretation of Computer Program
Strings
What are Strings?
A string is a sequence of ch
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 Computer Program
While Loop
Boolean Operators
What hap
Forman Christian College, Lahore (university status)
Programming 1
COMPUTER S COMP 102

Spring 2016
COMP 102
Structure and Interpretation of Computer
Programs
Omar Khan / Atif Alvi
Lecture 7
September 26/27, 2016
Omar Khan / Atif Alvi
COMP 102 Structure and Interpretation of Computer Program
Triangle
How can we draw this?
Omar Khan / Atif Alvi
COMP 102
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 integer n as input and outputs
# True or False depending
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 as
Pythons memory.
Frame :
At any point during the exec
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 Cryptanalysis
Techniques over DES
Anupam Kumar1, Aman Kumar2, Sah
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 chatting if the following
information is known? Either Kev
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]
Office
S 426
Office Hours Monday, Wednesday 12:00
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 passed Calculus, then he is registered for Discrete Math.
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 is written (a1, a2, , an).Its first
element is a1, etc
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 same meaning).We call
them equivalent. Learn:
Various
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.
?
?
SET
A set is a type of structure, representing a
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 logic treats simple propositions as
atomic entities.
I
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 and strings.
To represent how long it takes a computer t
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 algorithm for finding the
maximum (largest) value in a finite
s
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 algorithm for finding the
maximum (largest) value in a finite
s
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 concise notation for writing them.
A methodology for
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 words every element of its range has only 1
preimage.
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 function maps the set A onto (over, covering) the
entirety
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 array:
int FindMax(int * a, int SIZE);
EXAMPLE:
Sampl