0% found this document useful (0 votes)
12 views4 pages

Week 1

The document provides solutions and explanations for various programming and technical concepts, including C and C++ programming errors, data structures, Unix file systems, database management systems, operating system principles, SQL commands, and computer network transmission technologies. It discusses issues like memory management, data organization, and the importance of keys in databases. Additionally, it highlights concepts such as reentrancy in operating systems and the LIKE operator in SQL for pattern matching.

Uploaded by

as0876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Week 1

The document provides solutions and explanations for various programming and technical concepts, including C and C++ programming errors, data structures, Unix file systems, database management systems, operating system principles, SQL commands, and computer network transmission technologies. It discusses issues like memory management, data organization, and the importance of keys in databases. Additionally, it highlights concepts such as reentrancy in operating systems and the LIKE operator in SQL for pattern matching.

Uploaded by

as0876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Ashutosh Sharma RA2211003011350

C Programming

Solution - OUTPUT - 0

Solution - There is no print statement.

Solution - As ‘’ single quotes are used for char and strcat takes str as the second
argument we must use “!”.

Solution - We can use sizeof. Eg - int array_size = sizeof(array);

Solution – We can use - uint8_t value = read_memory(segment, offset);

C++ Programming
What is the output and explain the same?
Solution – The output is: "Say I am in SomeFunc." The output indicates that the
program encountered a double-free error and was aborted due to memory corruption.
The default copy constructor performs a shallow copy, causing multiple objects (s1 and
the temporary object) to share the same pointer. This leads to the double freeing of the
same memory. Additionally, <<endl is missing in void PrintVal().

Solution - Every non-static member function has an implicit parameter called the “this”
pointer, which refers to the calling object. It allows the member function to access the
object's data members and other functions.

Technical Questions
Data structures

A data structure is a way of organizing, managing, and storing data to enable efficient access
and modification. It provides a framework for handling data logically and helps in implementing
algorithms effectively. Common types include arrays, linked lists, stacks, queues, trees, and
graphs, each suited for specific types of operations and use cases, such as searching, sorting,
and data manipulation. Data structures are fundamental to computer science and
programming for solving complex problems efficiently.

• Artificial Intelligence and Machine Learning – For decision-making, data


modeling, and neural networks.
• Database Management Systems (DBMS) – For indexing, searching, and data
organization.
• Operating Systems – In process scheduling, memory management, and file
systems.
• Network Design – For routing, packet scheduling, and data transmission.
• Compiler Design – In syntax trees, symbol tables, and code optimization.

Unix

In Unix, devices are represented as special files in the /dev directory. These include character
devices (e.g., /dev/tty) for stream-based data and block devices (e.g., /dev/sda) for block-
based data. Each device file has a major number (identifying the driver) and a minor number
(identifying the device).

An inode (index node) is a data structure in Unix-like file systems that stores metadata about
a file or directory, excluding its name or data. It contains information such as the file's size,
permissions, owner, timestamps (creation, modification), and pointers to the data blocks on
disk where the file's content is stored. Each file is associated with a unique inode, allowing
efficient file management and access.
DBMS

A database is an organized collection of data that is stored and managed electronically,


typically in a digital format. It allows for efficient storage, retrieval, modification, and
management of data. Databases are structured using tables, rows, and columns, and can be
queried using languages like SQL. They are commonly used in applications such as websites,
business systems, and data analytics to store information like customer details, transactions,
and inventory.

In a database, a key is an attribute or a set of attributes that uniquely identifies a record in a


table. Keys are crucial for establishing relationships between tables and ensuring data
integrity.

Different types of keys in a database include:

1. Primary Key: A unique identifier for each record in a table. No two records can have
the same primary key value, and it cannot be null.
2. Foreign Key: A key used to establish a link between two tables. It is a column (or set
of columns) in one table that refers to the primary key in another table, ensuring
referential integrity.
3. Candidate Key: A set of attributes that could uniquely identify a record in a table. The
primary key is chosen from the candidate keys.
4. Unique Key: Similar to the primary key, but it allows for a null value in some cases. It
ensures that all values in the column are unique.
5. Composite Key: A key that consists of two or more attributes used together to
uniquely identify a record. It is often used when no single attribute can uniquely identify
a record.
6. Alternate Key: A candidate key that was not selected as the primary key.
7. Superkey: A set of one or more attributes that can uniquely identify a record in a table,
which may include extra attributes beyond those needed for uniqueness.

Operating system

In operating systems, reentrancy refers to the ability of a function to be safely interrupted and
called again before its previous execution completes, without causing errors or corrupting
data. A reentrant function does not rely on or modify shared resources and uses only local
variables, ensuring that each execution is independent. This allows the function to be safely
invoked in multi-threaded or interrupt-driven environments.

Belady's Anomaly refers to a situation in operating systems where increasing the number of
page frames can unexpectedly lead to more page faults. This counterintuitive behavior is most
often observed with certain page replacement algorithms, such as FIFO (First-In-First-Out),
where adding more memory does not always improve performance. Instead, under certain
memory access patterns, it can cause more frequent page faults, highlighting inefficiencies in
the algorithm's ability to manage memory.
SQL

The subset of SQL commands used to manipulate Oracle Database structures, including
tables, is called Data Definition Language (DDL). Common DDL commands include
CREATE (to create tables), ALTER (to modify tables), DROP (to delete tables), TRUNCATE
(to remove all rows from a table), and RENAME (to rename tables). These commands define
and modify database structures.

The LIKE operator in SQL performs pattern matching. It uses wildcards like % (any
sequence of characters) and _ (a single character) to search for patterns in a column.

Computer Networks

The two main types of transmission technology available in computer networks are:

1. Guided (Wired) Transmission: This involves physical media such as copper cables
(e.g., Ethernet cables), fibre optics, and coaxial cables, which guide the data signals
along a specific path.
2. Unguided (Wireless) Transmission: This involves the transmission of data through
the air using radio waves, microwaves, or infrared signals, with technologies like Wi-
Fi, Bluetooth, and cellular networks.

You might also like