CS310_Final-2.pdf

Verified academic study resource for CS310 (Introduction to Programming (Python)) under the Computer Science at Virtual University of Pakistan. This PDF document (Final-Term Solved Past Paper & Examination Pack) covers Final-Term Exam Scope (Lectures 23 to 45) spanning approximately 320 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS310 – Introduction to Programming (Python)
Faculty
Computer Science
Format
PDF
Type
Final-Term
Coverage
Final-Term Exam Scope (Lectures 23 to 45)

Virtual University regulations strictly require achieving at least 20% marks in the Final-Term exam paper alone (typically 12+ marks out of 60) to pass CS310, regardless of midterm scores.

What this file covers — CS310 syllabus roadmap

  1. Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
  2. Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
  3. Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
  4. Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)

Frequently asked questions

Where can I download CS310_Final-2.pdf for free?

You can preview and download "CS310_Final-2.pdf" (CS310 PDF, ~320 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs310-final-2-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS310 file?

This document covers Final-Term Exam Scope (Lectures 23 to 45) across 4 distinct lecture units (Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS310 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS310 solved past papers and handouts verified for 2026 exams?

Yes. All CS310 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

 The include statement takes all the
 text/code/markup that exists in the specified
 file and copies it into the file that uses the
 include statement.

 Including files is very useful when you want
 to include the same PHP, HTML, or text on
 multiple pages of a website.

include 'filename';

Assume we have a standard footer file called
"footer.php", that looks like this:

 <?php

 echo "<p>Copyright; 1990-" . date("Y") . "
 ABC.com</p>";

 ?>

To include the footer file in a page, use the include
statement:

<html>
<body>

<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>

<?php include 'footer.php';?>
</body>
</html>

 The PHP date() function is used to format a
 date and/or a time.

 The PHP date() function formats a timestamp
 to a more readable date and time.

Syntax
 date(format,timestamp)

 Parameter       Description
 format          Required. Specifies the format of the timestamp
 timestamp       Optional. Specifies a timestamp. Default is the
                 current date and time

    Note that the PHP date() function will return the current date/time
    of the server!

 The required format parameter of the date()
 function specifies how to format the date (or
 time).

 Here are some characters that are commonly
 used for dates:
 ◦ d - Represents the day of the month (01 to 31)
 ◦ m - Represents a month (01 to 12)
 ◦ Y - Represents a year (in four digits)
 ◦ l (lowercase 'L') - Represents the day of the week

 Other characters, like"/", ".", or "-" can also be
 inserted between the characters to add additional
 formatting.

 The example below formats today's date in
 three different ways:

<?php
echo "Today is " . date("Y/m/d") . "<br>";
echo "Today is " . date("Y.m.d") . "<br>";
echo "Today is " . date("Y-m-d") . "<br>";
 echo "Today is " . date("l");
?>

 Use the date() function to automatically
 update the copyright year on your website:

Example

&copy; 2010-<?php echo date("Y")?>      miss ;

 Here are some characters that are commonly
 used for times:

 ◦ h - 12-hour format of an hour with leading zeros
   (01 to 12)
 ◦ i - Minutes with leading zeros (00 to 59)
 ◦ s - Seconds with leading zeros (00 to 59)
 ◦ a - Lowercase Ante meridiem and Post meridiem
   (am or pm)

 The example below outputs the current time
 in the specified format:

<?php
echo "The time is " . date("h:i:sa");
?>

 If the time you got back from the code is not
 the right time, it's probably because your
 server is in another country or set up for a
 different timezone.

 So, if you need the time to be correct
 according to a specific location, you can set a
 timezone to use.

 The example below sets the timezone to
 "Asia/Karachi", then outputs the current time
 in the specified format:

Example

<?php
date_default_timezone_set("Asia/Karachi");
echo "The time is " . date("h:i:sa");
?>

 A cookie is often used to identify a user. A
 cookie is a small file that the server embeds
 on the user's computer.

 Each time the same computer requests a
 page with a browser, it will send the cookie
 too.

 With PHP, you can both create and retrieve
 cookie values.

A cookie is created with the setcookie()
function.

Syntax

setcookie(name, value, expire, path, domain,
secure, httponly);

Only the name parameter is required. All other
parameters are optional.

  Note: The setcookie() function must appear BEFORE the <html> tag.

   <?php
                            Modify= "Ahmed Cookie"
   $cookie_name = "user";
   $cookie_value = "Ahmed";
   setcookie($cookie_name, $cookie_value, time() + (86400
   * 30), "/"); // 86400 = 1 day
   ?>
   <html><body>            F5 return < Old
   <?php
   if(!isset($_COOKIE[$cookie_name])) {
       echo "Cookie named '" . $cookie_name . "' is not set!";
   } else {
       echo "Cookie '" . $cookie_name . "' is set!<br>";
       echo "Value is: " . $_COOKIE[$cookie_name];}
   ?>
   </body></html>

The value of the cookie is automatically URL encoded when sending the
cookie, and automatically decoded when received (to prevent URL
encoding, use setrawcookie() instead).

To delete a cookie, use the setcookie() function with an
expiration date in the past:

Example

<?php
// set the expiration date to one hour ago
setcookie("user", "", time() - 3600,"/");
?>
<html><body>
<?php
echo "Cookie 'user' is deleted.";
?>
</body></html>

ENABLE

 A session is a way to store information (in variables) to
  be used across several pages.
 Unlike a cookie, the information is not stored on the
  users computer.
 When you work with an application, you open it, do
  some changes, and then you close it. This is much like
  a Session.
 On the internet there is one problem: the web server
  does not know who you are, because the HTTP address
  doesn't maintain state.
 Session variables solve this problem by storing user
  information to be used across multiple pages (e.g.
  username etc.). By default, session variables last until
  the user closes the browser.
 Session variables hold information about one single
  user, and are available to all pages in one application.

   A session is started with the session_start() function.
   Session variables are set with the PHP global variable: $_SESSION.
   Now, let's create a new page called "session_demo1.php". In this page,
    we start a new PHP session and set some session variables:

Example
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html><body>
<?php
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";      Array
echo "Session variables are set.";
?>
</body></html>

     Note: The session_start() function must be the very first thing in your
                     document. Before any HTML tags.

 Next, we create another page called
 "session_demo2.php". From this page, we will
 access the session information we set on the first
 page ("session_demo1.php").

 Session variables are not passed individually to
 each new page, instead they are retrieved from
 the session we open at the beginning of each

More CS310 files

All CS310 files · Midterm Prep 2026 · MCQs Bank