Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Student’s name: Ali Hamza

Student’s ID: F2023266229


Section: V3
Course title: OOP Theory
Resource person: Nitasha Arooj Janjua
Semester: Spring 2024

Department of Computer Science


University of Management and Technology (UMT)
C-II Johar Town, Lahore 54770, Pakistan
Q1: GLOBLE VS LOCAL VERIABLE

The code snippet demonstrates variable scopes in a C++ program by showing the usage of
global and local variables within different blocks.

Q2: 2D Array input from user and display


The code snippet uses C++ to create and display a 3x3 2D array by taking user input for each
element and then printing the array's contents in rows.

Q3: Diamond Patteren using loop

This C++ code creates a pyramid pattern using stars. It uses nested loops to print spaces and
stars in a specific pattern to form the pyramid shape.

Q4: User define Function types

● Function with no argument and no return value.


● Function with no argument but return value.
● Function with argument but no return value.
● Function with argument and return value.
Example Code :

This code snippet showcases various types of functions in C++ and how they can be defined
and used within a program.

You might also like