CS405 Midterm Current Subjective Solved By Maha (MS-Team).pdf.pdf

Verified academic study resource for CS405 (Mobile Computing) under the Computer Science at Virtual University of Pakistan. This PDF document (Midterm Solved Past Paper & Revision File) covers Mid-Term Exam Scope (Lectures 1 to 22) spanning approximately 240 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS405 – Mobile Computing
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Tags
SUBJECTIVE, SOLVED, CURRENT, MIDTERM

Focus on core definitions and repeated MCQs from Lectures 1–22. Remember that scoring in the First Half builds your safety buffer toward the mandatory 20% Two-Half passing rule in CS405.

What this file covers — CS405 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)

Frequently asked questions

Where can I download CS405 Midterm Current Subjective Solved By Maha (MS-Team).pdf.pdf for free?

You can preview and download "CS405 Midterm Current Subjective Solved By Maha (MS-Team).pdf.pdf" (CS405 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs405-midterm-current-subjective-solved-by-maha-ms-team-pdf-pdf) with 100% free high-speed downloads and zero registration requirements.

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

This document covers Mid-Term Exam Scope (Lectures 1 to 22) across 4 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS405 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 CS405 solved past papers and handouts verified for 2026 exams?

Yes. All CS405 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

By Maha Rana

Short Questions:

1. Syntax of IF-THEN-ELSE Statement

The IF-THEN-ELSE statement in PL/SQL is used for conditional execution.

✅ Syntax:
IF condition THEN
   -- Execute when condition is TRUE
ELSE
   -- Execute when condition is FALSE
END IF;

✅ Example:
DECLARE
   salary NUMBER := 5000;
BEGIN
   IF salary > 4000 THEN
      DBMS_OUTPUT.PUT_LINE('High Salary');
   ELSE
      DBMS_OUTPUT.PUT_LINE('Low Salary');
   END IF;
END;

👉 Output
High     (if salary = 5000):
     Salary

By Maha Rana

2. Syntax of HAVING Clause

The HAVING clause is used in SQL to filter groups of records created by the
GROUP BY clause.
✅ Syntax:

SELECT column_name, COUNT(*)

FROM table_name

GROUP BY column_name

HAVING condition;

✅ Example:
SELECT deptno, AVG(salary)
FROM employees
GROUP BY deptno
HAVING AVG(salary) > 50000;

Explanation:

     GROUP BY deptno groups records based on department number.
     HAVING AVG(salary) > 50000 filters only those departments where
     average salary is greater than 50,000.

✅ Key Difference:
      WHERE is used to filter individual rows.
      HAVING is used to filter groups after aggregation.

3. Difference between Primary Key and Unique Key

By Maha Rana

✅ Example Table:
CREATE TABLE employees (
   emp_id NUMBER PRIMARY KEY,              --Primary Key (No NULL,
Unique)
   email VARCHAR2(100) UNIQUE               --Unique Key (NULL
Allowed, Unique)
);

Long Questions:

1. Difference Between GROUP FUNCTION and GROUP BY Clause

✅ Example of GROUP FUNCTION (No GROUP BY)
SELECT COUNT(*) FROM employees;

👉 Output: Returns the total number of employees.
✅ Example of GROUP BY Clause

By Maha Rana

SELECT deptno, COUNT(*) FROM employees GROUP BY deptno;

👉Output:Groups employees by deptno and counts the numberof employees in
each department.

✅ Key Difference:
     GROUP FUNCTIONS perform operations on multiple rows.
     GROUP BY groups rows based on a column and then applies group
     functions.

2. Query-Based Code (Assumed Example)

✅ Retrieve Employee Names with Salary Greater Than Average Salary
DECLARE
   avg_salNUMBER;
BEGIN
   --Gettheaverage salary
   SELECTAVG(salary) INTO avg_sal FROM employees;

   --Displayemployees earning more than the average
salary
   FORempIN(SELECT ename, salary FROM employees
WHEREsalary>avg_sal) LOOP
       DBMS_OUTPUT.PUT_LINE(emp.ename || ' earns'||
emp.salary);
   END LOOP;
END;
👉 Purpose: Finds and prints all employees earning above the average salary.

3. Multiplication of First 10 Natural Numbers with 10

✅ Loop-Based PL/SQL Code

By Maha Rana

DECLARE
   iNUMBER;
BEGIN
   FORiIN 1..10 LOOP
      DBMS_OUTPUT.PUT_LINE(i || ' x 10 = ' || (i*
10));
   ENDLOOP;
END;

👉 Output:
1x10=10
2x10=20
3x10=30
4x10=40
5x10=50
6x10=60
7x10=70
8x10=80
9x10=90 10 x
10 = 100

Short Questions:

1. PL/SQL Command to Print a Message

In PL/SQL, we use DBMS_OUTPUT.PUT_LINE to print messages.

✅ PL/SQL Print Command:

By Maha Rana

  DBMS_OUTPUT.PUT_LINEis used to print output in PL/SQL programs.
  Enable Server Output using:
SET SERVEROUTPUT ON;

2. Finding Error in Given SQL Command

❌ Example of Incorrect SQL Query:
SELECT * FROM employee WHERE name = Ali;

✅Error: Missing singlequotes( 'Ali' shouldbeinquotes).
✅Correct Query:
✅ Other Common Errors:
SELECT * FROM employee WHERE name = 'Ali';
❌ Using SELECT without FROM clause
❌ Incorrect column names that don’t exist in the table
❌ Forgetting WHERE condition for UPDATE or DELETE queries.
3. ROLLBACK Command and Its Syntax

By Maha Rana

ROLLBACK is a SQL command used to undo uncommitted transactions.

✅Syntax of ROLLBACK:
✅
ROLLBACK;
  Example Usage:
BEGIN

    INSERT INTO employees (emp_id, name, salary) VALUES
(101, 'Ali', 50000);
    ROLLBACK; -- Undo the INSERT operation
END;
👉 Tip: If
          COMMIT isnotexecuted, ROLLBACK undoesthechanges.

Long Questions:

        1. Basic Syntax of a PL/SQL Block

PL/SQL programs follow a block structure.

✅ Basic PL/SQL Block Syntax:
DECLARE
   -- Variable declarations
BEGIN
   -- Executable statements
EXCEPTION
   -- Exception handling (optional)
END;
✅ Example:
DECLARE

   message VARCHAR2(50) := 'Hello, PL/SQL!';
BEGIN
   DBMS_OUTPUT.PUT_LINE(message);
END;

Tip: The DECLAREand EXCEPTIONsections are optional.

By Maha Rana

2. PL/SQL Code for ROLLBACK (Insert, Update & Display Row Count)

This PL/SQL block will:

  1. Insert a new row into a table.
  2. Update an existing row.
  3. Display the number of rows before and after ROLLBACK.

✅ PL/SQL Code:

                                                                   👉
Expected
TotalRowsOutput:
             Before ROLLBACK:X
TotalRows After ROLLBACK:Y              -- (X includes new row)
count)                                  -- (Y is original row

✅ Tip:
     ROLLBACK undoes all changes made after the last COMMIT.

By Maha Rana

      SELECT COUNT(*) is used to count total rows before and after
      rollback

3. Scenario-Based Entity Identification

In database design, Entities represent real-world objects. For example, if the
scenario was about a Library System, the entities might be:

    1. Book
    2. Student
    3. Librarian
    4. Loan Transaction

✅ Example ERD (Entity-Relationship Diagram) Entities:

Short Questions:

1. What is a Foreign Key?

A foreign key is a column (or a set of columns) that references the primary key
of another table. It ensures referential integrity between tables.
✅  Key Points:

      Used to create relationships between two tables.
      Helps prevent orphan records (records in the child table without a
      corresponding parent).
      Referenced column must be a primary key in the parent table.

✅ Example of Foreign Key:

By Maha Rana

👉 Here, class_id in Students references class_id in Classes.
👉 If a class is deleted, it prevents students from referencing a non-existing
class.
2. PL/SQL Code to Display Student Name and Address using SELECT INTO

✅ Scenario: A student table is given, and we need to retrieve Student Name and
Address using SELECT INTO.
✅ PL/SQL Code:

By Maha Rana

👉Explanation:

More CS405 files

All CS405 files · Midterm Prep 2026 · MCQs Bank