Unit6 - Subjective Questions

CSE101 • Practice Questions with Detailed Answers

1

Define a Structure in C/C++. Explain the syntax for declaring a structure, defining structure variables, and accessing their members with an example.

2

Explain the concept of Pointers to Structures. How are structure members accessed using a pointer? Illustrate with a code snippet.

3

Differentiate between Structure and Union with respect to memory allocation and value access. Provide a comparative table.

4

What are Nested Structures? Describe how to declare and access members of a nested structure using an example.

5

Compare Procedural Oriented Programming (POP) and Object-Oriented Programming (OOP) paradigms.

6

Explain the input and output mechanisms in C++ using cin and cout with appropriate syntax and examples.

7

Define Class and Object in C++. How are they related? Write a simple C++ program to define a class Student with data members and member functions.

8

What are Inline Functions? How do they differ from normal functions? Discuss their advantages.

9

Explain the concept of Static Data Members in C++ classes. How are they initialized and accessed?

10

What are Static Member Functions? How do they differ from non-static member functions?

11

Explain the method of defining member functions outside the class definition in C++. What operator is used?

12

Distinguish between Structures and Classes in C++. What is the default access specifier for each?

13

What is a Union? Write a C program to demonstrate the declaration of a union and how modifying one member affects the others.

14

Compare Enumerations, Structures, Unions, and Classes.

15

How are structure members initialized? Discuss both compile-time initialization and designation initialization (C99 standard).

16

Explain Access Specifiers in C++. What are public and private members?

17

What is an Array of Structures? Describe how to declare and traverse an array of structures with an example.

18

Describe the syntax for declaring a Union. Can a union contain a structure? Explain with an example.

19

Explain the role of the Scope Resolution Operator (::) in C++ with respect to class member definition and static members.

20

Write a C++ program to create a class Employee with private data members id and salary, and public member functions to input and display the data.