munotes®

BSc CS Sem 2 Introduction to OOP using C++ Mar 2025 Question Paper with Solutions

Mumbai University Solved Question Papers munotes.in

Introduction to OOP using C++

BSc CS · Sem 2

Mar 2025 Examination

Previous Year Question Paper with Solution

munotes.in Mumbai

munotes.in

First published on munotes.in on 12 November 2026.

This edition revised 13 November 2026.

Published by munotes.in, Mumbai.

Model answers written and edited by the munotes.in editorial desk.

Passages from this volume may be quoted, in print, online or by an AI system, with credit: name munotes.in and link to this volume's page. The volume may not be reproduced as a whole. Full terms at munotes.in/content-license.

munotes.in is an independent study resource for students of the University of Mumbai. It is not affiliated with the University of Mumbai, and is not endorsed by it.

The University does not publish an official answer key for this paper. The answers in this volume are model answers, written to show how a full-mark answer is built. They are a study aid, not an authority on what an examiner marked.

The question paper reproduced here is the paper as set by the University of Mumbai at the Mar 2025 examination.

munotes.in ii

Contents

The questions below are the paper as the University of Mumbai set it at the Mar 2025 examination, in the order it was set.

MarksPage

munotes.in iii

The Paper as Set

The questions in this volume are the questions asked at the Mar 2025 examination, reproduced as the University of Mumbai set them, in the order it set them. Nothing has been reworded, added or left out. Only the answers are ours. See the original question paper.

Duration 1 hours  ·  Total marks 30  ·  12 questions answered

How to use this volume

Solve the paper first, under exam conditions and against the clock. Then read the answers here and mark your own. Reading a solution before attempting the question feels productive and teaches very little, because recognising an answer is not the same as being able to write one.

munotes.in iv

SECTION I

Q.1 Attempt any 2 from the following 10 Marks

munotes.in 1

1.What are tokens? Explain any three types of tokens.[5]

Answer

For full marks, cover: the definition of a token, the five kinds with an example of each, three kinds explained in detail with their rules, and a statement split into its tokens.

What a token is

A token is the smallest individual unit of a C++ program. Before the compiler can understand a statement, it cuts the statement into tokens, as a reader splits a sentence into words. Spaces, tabs, newlines and comments are not tokens; they only keep tokens apart.

C++ has five kinds of token:

KindExamples
Keywordsint, class, return
Identifiersscored, maxMarks, Student
Constants87, 100.0, 'A'
Strings"per cent"
Operators=, *, <<

The separators ;, { }, ( ) and , are called punctuators.

munotes.in 2

1. Keywords

A keyword is a word reserved by C++ with a fixed meaning, such as int, double, char, if, while, class, public and return. Keywords are written in lowercase. A keyword cannot be used as a name: int class; does not compile.

2. Identifiers

An identifier is a name the programmer gives to a variable, function, class or object. The rules are:

  1. It may contain letters, digits and the underscore _ only.
  2. It must not begin with a digit.
  3. It must not be a keyword.
  4. It contains no spaces or other symbols.
  5. It is case sensitive, so marks and Marks are two different names.

Valid: total_marks, _count, maxMarks. Invalid: 2ndRank (starts with a digit), roll no (has a space) and float (a keyword).

3. Constants

A constant, also called a literal, is a fixed value written directly in the program.

munotes.in 3
  1. Integer constants: whole numbers such as 87, -5 and 0.
  2. Real constants: numbers with a fraction, such as 100.0 and 3.14.
  3. Character constants: one character in single quotes, such as 'A' or '\n'.

A named constant is made with const, as in const int maxMarks = 100;. Its value cannot be changed later.

Tokens in a program

  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. const int maxMarks = 100;
  5. int scored = 87;
  6. char grade = 'A';
  7. double percent = scored * 100.0 / maxMarks;
  8. cout << "Grade " << grade << ", " << percent << " per cent\n";
  9. return 0;
  10. }

Output:

munotes.in 4

Grade A, 87 per cent

The statement double percent = scored * 100.0 / maxMarks; has nine tokens:

TokenKind
doublekeyword
percentidentifier
=operator
scoredidentifier
*operator
100.0constant
/operator
maxMarksidentifier
;punctuator

Conclusion. A token is the smallest unit of a C++ program. The five kinds are keywords, identifiers, constants, strings and operators. Keywords are reserved words, identifiers are names that follow fixed rules, and constants are fixed values such as 87 or 'A'.

munotes.in 5

The rest of the answers

The first answer is free. The rest come with the B.Sc. (Computer Science) Semester 2 solved papers.

You have read the question paper and its first answer in full. Buy the solved papers once and you can read every answer of every solved paper in this semester.

Notes + practical solutions + solved papers: ₹798 Already bought it? Sign in

Or solved papers only: ₹499
Or notes + practical solutions: ₹499

The question paper itself stays free, and so does the syllabus.

Issue

Found an error in this volume? Report it and we will check it against the paper.

Done!