Java Object-Oriented Programming Concepts and Solutions
Core Concepts of Object-Oriented Programming
False. An abstract class cannot be instantiated directly. You cannot create an object of an abstract class using new. You must create an object of a concrete subclass.
False. Java does not allow a class to extend more than one class. However, a class can implement multiple interfaces.
False. Method overloading means having the same method name but different parameter lists. A different return type alone is not enough.
True. The reference type determines which
Read MoreIt used to define the member functions of a class outside
15 Demonstrate nesting of member function.
Class
Student
{ int marks;
void showMarks()
{ cout
<< "Marks = " << marks << endl;
}
public:
Void getMarks()
{ marks = 85;
ShowMarks(); // Calling another member function
}
};
Int main()
{ Student s;
S.GetMarks();
Return 0;
}
4 Write a short note on defining member functions.1. Defining the function inside the class
class Student
{ int age;
public:
void display()
{ cout << “Age = ” << age;
Comprehensive Guide to Blockchain Systems, CAP Theorem, and Cryptography
1. Centralized, Decentralized, and Distributed Systems
1. Centralized System
A centralized system is a system where a single central authority or server controls the entire system. All operations and data are managed by this central authority.
Example: Traditional banking system.
Client
v
+--------------+
| Central |
| Server |
+--------------+
/ | \
v v v
Client Client Client
Features:
- Single authority controls the system.
- Data is
Systems Programming: Memory, I/O, and Concurrency
Virtual Memory and Memory Management
Virtual Memory (VM): The virtual address space is divided into fixed-size pages (standard 4KB); physical memory serves as a cache for these pages. A page table (which is per process) maps virtual pages to physical pages or marks them as invalid/unmapped.
Address Translation and Page Faults
Address Translation: The Virtual Address (VA) is composed of [VPN | VPO]. The Memory Management Unit (MMU) looks up the Virtual Page Number (VPN) in the page table to get a Page
Read MoreCore C Language Fundamentals and Practical Programs
C Program to Find the Largest of Three Numbers
#include <stdio.h>
int main() {
int a, b, c;
printf("Enter three numbers: ");
scanf("%d %d %d", &a, &b, &c);
if (a >= b && a >= c) {
printf("%d is the largest.\n", a);
} else if (b >= a && b >= c) {
printf("%d is the largest.\n", b);
} else {
printf("%d is the largest.\n", c);
}
return 0;
}C Program to Check Positive, Negative, or Zero
#include <stdio.Read More
Computer Networking and Architecture Fundamentals
Data Transmission and Networking
What is a packet?
A packet is a small unit of data sent across a network. Large files are divided into packets so they can be transmitted more efficiently.
What is a header?
A header is part of a packet. It contains the destination address and sequencing information so the packet reaches the correct device.
What is a payload?
A payload is the part of a packet that contains the actual data being sent.
What is a trailer?
A trailer is the last part of a packet. It contains
Read More