Essential Python Programming Examples and Exercises
String Manipulation
str1 = input("Enter first string: ")
str2 = input("Enter second string: ")
if str2 in str1:
print("Second string is present in first string")
else:
print("Second string is NOT present in first string")Removing Substrings
onestring = input("Enter main string: ")
removestring = input("Enter string to remove: ")
if removestring in onestring:
finalstring = onestring.replace(removestring, "")
print("Final string is:", finalstring)
else:
print("String not found")Number
Read MoreEssential Java Programming Concepts and Interview Questions
1. Event Handling Model in Java
Event Handling is a mechanism that controls events generated by user actions such as mouse clicks, key presses, or button clicks. Java utilizes the Delegation Event Model.
Components of Event Handling
- Event Source: The object that generates an event (e.g., Button, TextField, Frame).
- Event Object: An object containing information about the event (e.g.,
ActionEvent,MouseEvent,KeyEvent). - Event Listener: An interface that receives and handles events (e.g.,
ActionListener,
Parallel Programming Examples: OpenMP and MPI Code Snippets
1. OpenMP Parallel Loop Scheduling
#include <stdio.h>
#include <omp.h>
int main() {
int n = 16, thread;
printf("\nEnter the number of tasks: ");
scanf("%d", &n);
printf("\nEnter the number of threads: ");
scanf("%d", &thread);
omp_set_num_threads(thread);
printf("\n--------------------------------------\n");
#pragma omp parallel for schedule(static, 2)
for (int i = 0; i < n; i++) {
printf("Thread %d executes iteration %d\n", omp_ Read More
Essential Database Management Systems Concepts
1. Data, Databases, and DBMS
Data refers to raw facts and figures which by themselves have no meaning (e.g., numbers, names, marks, dates). When processed and organized, it becomes meaningful information.
A database is an organized collection of related data stored in a structured manner for easy access, management, and updates (e.g., a student database).
A Database Management System (DBMS) is software that allows users to create, store, retrieve, update, and manage databases efficiently (e.g., MySQL,
Read MoreFlutter Implementation: Cart and Room Management
Flutter Shopping Cart Implementation
This example demonstrates how to create a simple Shopping Cart interface in Flutter using TextEditingController and StatefulWidget to manage item inputs and calculate totals.
import 'package:flutter/material.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: CartScreen());
}
}
class Item {
String name;
int qty;
double price;
Item(this.name, this. Read More
Mastering SQL Server Fundamentals and Azure Database Services
SQL Fundamentals & Azure IaaS
1. Database Fundamentals
RDBMS vs. NoSQL:
- RDBMS: Organized store of data, minimizes redundancy, reduces inconsistency. Stores data in tables (rows/columns).
- DBMS Types:
- Open Source: MySQL, MariaDB, PostgreSQL.
- Proprietary: Oracle, Microsoft SQL Server, IBM DB2.
SQL Server Editions:
- Express: Free, limited size/performance.
- Developer: Free/low-price, full features, dev use only.
- Standard/Enterprise: Production use, terabytes of data.
Data Types:
- Numeric: int, bigint, decimal,
