CS508-MidTerm-byMrAttitude.pdf

Verified academic study resource for CS508 (Modern Programming Languages) 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
CS508 – Modern Programming Languages
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Tags
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 CS508.

What this file covers — CS508 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 CS508-MidTerm-byMrAttitude.pdf for free?

You can preview and download "CS508-MidTerm-byMrAttitude.pdf" (CS508 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs508-midterm-bymrattitude-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS508 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 CS508 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 CS508 solved past papers and handouts verified for 2026 exams?

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

                     2014-2015
        Cs 508 MidTerm Papers

    1

                     Mr Attitude
1                    Virtual University
                     2014-2015

                                                   Cs 508 MidTerm Papers 2014-
                                                                         2015
M

CS508 - Modern Programming Languages - Q. No. 1 M - 5
Compare ADA dor loop with dolist and dotime in LISP

Answer: - page 72
Iteration: dotimes and dolist
Apart from recursion, in LISP we can write code involving loops using iterative non recursive
mechanism. There are two basic statements for that purpose: dotimes and
dolist. These are discussed in the following paragraphs.
dotimes
dotimesis like a counter-control for loop. Its syntax is given as below:
(dotimes(count n result) body)
It executes the body of the loop n times where count starts with 0, ends with n-1.
The result is optional and is to be used to hold the computing result. If result is given, the function will
return the value of result. Otherwise it returns NIL. The value of the count can be used in the loop body.
dolist
The second looping structure is dolist. It is used to iterate over the list elements, one at a
time. Its syntax is given below:
(dolist(x L result) body)
It executes the body for each top level element x in L. x is not equal to an element of L in each iteration,
but rather x takes an element of L as its value. The value of x can be used in the loop body. As we have
seen in the case of dotimes, the resultis optional and is to be used to hold the computing result. If result is
given, the function will return the value of result. Otherwise it returns NIL.

Q. No. 2 M - 5
Differentiate between ADA access types and C/C++ pointer type
Answer:- page 52
An access type roughly corresponds to a C++ pointer.
typeAddress_Ref is access Address;
A_Ref := new Address;
A_Ref.Postal_Code := "94960-1234";
Note that, unlike C, there is no notational difference for accessing a record field directly
or through an access value.
To refer to the entire record accessed by an access value use the following notation:
Print(A_Ref.all);

Q. No. 3 M - 3
Why predicate is a special function in LISP
Solution:- page 67
Predicates
A predicate is a special function which returns NIL if the predicate is false, T or anything other than NIL,
otherwise. Predicates are used to build Boolean expressions in the logical Statements.
The following comparative operators are used as functions for numerical values and return a T or NIL. =,
>,<,>=,<=;
For example:
     (= (+ 2 4) (* 2 3))
     T

2

                                                   Cs 508 MidTerm Papers 2014-
                                                                         2015
     (> (- 5 2) (+ 3 1))
     NIL

CS508 - Modern Programming Languages - Q. No. 4 M - 3
Differentiate between C/C++ unions and ADA discriminated type (3)
 Solution:- page 52
Discriminated Records
Discriminated records are like union types in C. There are however major differences between C union
types and Ada discriminated records. The union type in C is fundamentally unsafe, and therefore
unacceptable. For example, consider the following
definition:
union(int, float) puzzle;

Now puzzle has either an intor a float. But at runtime, the compiler and the environment cannot tell which
particular value has been stored currently. So we have to trust the programmer. In Ada we are short on
trust. The whole philosophy is that a programmer is a human and all humans make mistakes. So to make
it safer, Ada uses discriminates in a record that tells what type of data is currently stored there. This is
shown in the following
example:
typeIF is(Int, Float);
typeInt_Float (V : IF := Int) is record
caseV is
whenInt => Int_Val : Integer;
whenFloat => Float_Val : Float;
end case;
end record;

CS508 - Modern Programming Languages - Q. No. 5 M - 2
What additional features are added in COBOL

Answer:- page 27

It was the first language to add macro facility in a high-level language. It also introduced hierarchical data
structures(records) and nested selection statements. The language supported long variable names (up to 30
characters) with hyphens, data division, and fixed-point arithmetic.

CS508 - Modern Programming Languages - Q. No. 6 M - 2
Is there anything like templates as in C++.
 Answer: - page 60

Generics are like templates in C++ and allow parameterization of subprograms and packages with
parameters which can be types and subprograms as well as values and objects.

Question 1 (2 marks)
Whether polymorphism is allowed in Ada or not? Briefly state.
Answer:-

3

                                                  Cs 508 MidTerm Papers 2014-
                                                                        2015
http://archive.adaic.com/docs/present/engle/whyada/tsld021.htm

Ada 83 supported a form of polymorphism through the use of overloading that allowed the developer to
reuse a procedural name or operator by redefining the context and semantics. For example, when using
integer numbers, the + sign adds one integer to another. The + operator could be redefined to work with
an abstract data type consisting of a set of colors and provide the proper color mix (i.e., red + yellow =
orange). This polymorphic behavior had to be resolved at compile time. Ada 95 supports a true
polymorphic operation through the use of class-wide types and type extensions, which can contextually
recognize the appropriate operation to perform.

http://archive.adaic.com/docs/present/engle/whyada/tsld021.htm

Question 2 (2 Marks)

How Bitwise Exclusive Or, and Not is represented in Ada?

Answer:-
Bitwise Exclusive Or           =Xor
Bitwise Not                      =Not
Logical Not                     =Not

Question 3 (3 Marks)

Identify Local and Global variable

>(defun y-plus(x)(+x y))

Answer:-page 69

This function adds x to y where x is the parameter passed to the function and y is a global variable since it
is not defined inside the function. It works in the following manner:
>(setq y 2)
>(y-plus 23)
25

More CS508 files

All CS508 files · Midterm Prep 2026 · MCQs Bank