JSD Second Year Notes 2023-24 PDF
Document Details
Uploaded by CompliantSunflower
JSD
Tags
Summary
These notes cover foundational concepts in Relational Database Management Systems (RDBMS), focusing on MySQL. It includes definitions, limitations, and advantages of file-based systems and DBMS, a discussion of RDBMS, and introduces key concepts within relational data models such as relations, tuples, and attributes.
Full Transcript
Unit 1 - Relational Database Management System – MySQL Database: A database is an organised collection of structured information or data, typically stored electronically in a computer system. File based system and its limitations: The systems that are used to organise and maintain data files are k...
Unit 1 - Relational Database Management System – MySQL Database: A database is an organised collection of structured information or data, typically stored electronically in a computer system. File based system and its limitations: The systems that are used to organise and maintain data files are known as file based data systems. These file systems are used to handle a single or multiple files and are not very efficient. Limitations: The File based system cannot store large amounts of data. There may be redundant data in the file based system The data is not very secure in a file based system It is difficult to share the data easily with multiple users. Database Management Systems (DBMS): A Database Management System (DBMS) is a software system that is designed to manage and organise data in a structured manner. It allows users to create, modify, and query a database, as well as manage the security and access controls for that database. RDBMS(Relational Database Management System): DBMS in which Data is stored in tables is known as RDBMS. Eg:- Oracle,SQL Server, Mysql , MS Access, DB2 Advantages of DBMS: 1) Efficient data access: DBMS provides a variety of techniques to store and retrieve data efficiently. 2) Data integrity & security: DBMS enforces data integrity constraints and it ensures data security. 3) Concurrent access: Database can be used by different users at a time. 4) Crash recovery: Even if the system is failed (crashed) database can be recovered safely. Disadvantages of DBMS: 1) Size: The functionality of DBMS makes use of a large piece of software which occupies megabytes of disk space. 2) Performance: Performance may not run as fast as desired. 1 Difference between File System and DBMS: FILE SYSTEM DBMS Used to manage and organise the files stored A software to store and retrieve the user’s in the hard disk of the computer data Redundant data is present No presence of redundant data Less security Supports more security mechanisms Concepts of DBMS: The fundamental concepts and features of a DBMS include data models, query languages, file organisation, normalisation, candidate keys and key fields. Relational Data Model: In this model, Data and Relationships are structured as tables Advantages: Simple format By using key attributes records can be retrieved effectively Representation of different types of relationship is possible Relation: It refers to a table in a relational database and relationships that can be created between those tables. Tuples: Rows in a relation(table) are called Tuples Attributes: Columns in a relation(table) are called Attributes Schema of a Relation: Schema refers to the structure of the table. The schema includes Name of the relation and all attributes. Eg:- Employee(EmpID, EmpName, Designation) Degree of a Relation: Number of Attributes (Columns) in a relation(table) is called Degree. Cardinality of a Relation: Number of Tuples (Rows) in a relation(table) is called Cardinality. 2 Q.Complete the following questions based on the student table Student StudId RollNo Name Email 1 11 Tom Price [email protected] 2 12 Nick Wright [email protected] 3 13 Dana Natan [email protected] a)What is the degree of the above Relation( Table)? Ans:- 4 b)What is the cardinality of the above Relation (Table) ? Ans:- 3 Keys in DBMS: Keys in DBMS is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table). Candidate Key : The minimal set of attributes that can uniquely identify a tuple is known as a candidate key. A relation can have more than one Candidate key 3 Primary Key : It is a column or group of columns in a table that uniquely identifies every row in that table. A minimal Candidate key is selected as Primary Key for the table. A relation can not have more than one Primary key. It must be unique. Primary Key field can not contain NULL value. Alternate Key : The candidate key other than the primary key is called an alternate key. Composite Key (Composite Primary Key) : A Composite Primary Key is created by combining two or more columns in a table that can be used to uniquely identify each row in that table. Super Key : A super key is a group of single or multiple keys which identifies rows in a table. 4 Foreign Key (Reference Key): Foreign key is used to establish relationships between two tables. A foreign key helps us to maintain data as well as referential integrity. An attribute in a table, which is a primary key in another table is called Foreign Key. Structured Query Language (SQL): SQL is a standard language for storing, manipulating, and retrieving data in databases. Advantages: Faster :- Large amounts of data is retrieved quickly and efficiently. Standardised Language :- It provides a uniform platform worldwide to all its users. Easy to Use :- No programming skill is required for SQL users. Portable :- SQL can be used in programs in windows, Linux etc independent of any platform. Multiple Data view :- Data can be viewed as per the user’s requirement. MySQL Installation in Ubuntu: Step 1: To install it, update the package index on your computer using the following command $sudo apt update Step 2: Then install the mysql-server package: $sudo apt install mysql-server Step 3: Ensure that the server is running using the systemctl start command: $sudo systemctl start mysql.service Step 4: Check the mysql version installed using the following command $mysql --version 5 Step 5: If everything ok, you can login using the following command $mysql -u root -p (default password is blank [no password]) Data types in SQL: Datatype Description CHAR(Size) It is used to specify a fixed length string that can contain numbers, letters, and special characters. VARCHAR(Size) It is used to specify a variable-length string that can contain numbers, letters, and special characters. INT(size) It is used for the integer value. DECIMAL(size, d) It is used to specify a fixed point number. Its size parameter specifies the total number of digits. The number of digits after the decimal parameter is specified by d parameter. T DATE It is used to specify date format YYYY-MM-DD. Differences between CHAR and VARCHAR: CHAR VARCHAR Used to store strings of fixed size Used to store strings of variable length Fixed memory usage Variable memory usage Constraints in SQL: SQL constraints are used to specify rules for the data in a table. Constraints are used to limit the type of data that can go into a table. Constraints can be column level or table level. Column-level constraints apply to a column, and table-level constraints apply to the whole table. 6 Constraint Description NOT NULL Ensures that a column cannot have a NULL value UNIQUE Ensures that all values in a column are different PRIMARY KEY Uniquely identifies each row in a table DEFAULT Sets a default value for a column if no value is specified CHECK Ensures that the values in a column satisfy a specific condition Types of SQL: Data Definition Language (DDL): DDL specifies the structure of the table like creating a table, deleting a table, altering a table, etc. Four important DDL commands are CREATE, ALTER, DROP AND TRUNCATE CREATE TABLE: Used to create a table structure. 7 Syntax:- CREATE TABLE table_name (column1 datatype constraints, column2 datatype constraints, ……………………..……….. columnN datatype constraints); Eg:- CREATE TABLE student (admno INT NOT NULL, name VARCHAR(100), course VARCHAR(100), PRIMARY KEY(admno)); Output:- student admno name course ALTER TABLE: Used to alter existing table structure. a)ALTER TABLE ADD - Used to add a new column to an existing table. Syntax:- ALTER TABLE table_name ADD Column_name data type constraints; Eg:- ALTER TABLE student ADD mark INT; Output:- student admno name course mark b)ALTER TABLE DROP - Used to delete a column from an existing table. 8 Syntax:- ALTER TABLE table_name DROP Column_name; Eg:- ALTER TABLE student DROP mark; student admno name course c)ALTER TABLE MODIFY -Used to change column properties of an existing table. Syntax:- ALTER TABLE table_name MODIFY existing column_name datatype constraints; Eg:- ALTER TABLE student MODIFY mark decimal(5,2); DROP TABLE: To delete the table from the database (Including structure). Syntax:- DROP TABLE table_name; Eg:- DROP TABLE student; TRUNCATE TABLE The TRUNCATE TABLE command deletes the data inside a table, but not the table itself. Syntax:- TRUNCATE TABLE table name; Eg:- TRUNCATE TABLE student; 9 Data Manipulation Language (DML): DML commands are used to modify the database contents. Three important DML commands are INSERT, UPDATE AND DELETE INSERT INTO - Used to insert values into the table. To insert data to all the columns: Syntax:- INSERT INTO table_name VALUES (Value1, Value2,…… Value N); Eg:- INSERT INTO student VALUES (1001,’ Mahesh’, ’JSD’, 80); To insert data to specified columns: Syntax:- INSERT INTO table_name (Column1, Column2,......, Column N) VALUES (Value1, Value2, …… Value N); Eg:- INSERT INTO student (admno, name, course, mark) VALUES (1001,’ Mahesh’, ’JSD’, 80); UPDATE SET - To change the existing data in a table. SET and WHERE are used with UPDATE for this purpose. If the WHERE clause is not used, updation will be affected to all data in the column specified. Syntax:- UPDATE table_nameSET column_name=new value WHERE conditions; Eg:- UPDATE student SET course=’AOPO’ WHERE admno=1001; DELETE FROM - To delete data from table To delete all the data: Syntax:- DELETE FROM table_name; Eg:- DELETE FROM student; 10 To delete specified data: Syntax:- DELETE FROM table_name WHERE conditions; Eg:- DELETE FROM student WHERE admno=1001; Data Query Language (DQL): DQL is used to fetch the data from the database. SELECT - Used to view the table data To view all the columns: Syntax:- SELECT * FROM table_name; Eg:- SELECT * FROM student; To view the tuples satisfying a condition: Syntax:- SELECT * FROM table_name WHERE condition; Eg:- SELECT * FROM student WHERE admno=1001; To view specified columns: Syntax:- SELECT coulmn1,column2,..., columnN FROM table_name; Eg:- SELECT admno, name FROM student; Data Control Language(DCL): GRANT - To grant privilege to the user. REVOKE - To remove privilege from the user. Transaction Control Language(TCL): COMMIT - This command is used to save all the transactions in the database. 11 ROLLBACK - This command could only be used in order to reverse transactions that occurred since the last ROLLBACK or COMMIT command. SAVEPOINT - It is used to roll back a certain transaction to a certain point rather than the entire transaction. Clauses in SQL: Clause Description WHERE The WHERE clause in SQL is used to retrieve the specific data from the database that specifies the conditions exactly that are given in the UPDATE, DELETE, etc. statements. ORDER BY The ORDER BY clause in SQL is used for sorting the records of the database tables. GROUP BY To group the result set of the rows that have the same values in the result set from the database tables, the GROUP BY clause is used. HAVING HAVING clause can be used in a GROUP BY clause. It is used to specify a search condition for a group in the database tables SQL Functions: SQL has many built-in functions. There are two types 1) Single Row Functions 2) Aggregate Functions Single row Functions: Single row functions are used to manipulate data items. Single-row functions require one or more input arguments and operate on each row, thereby returning one output value for each row. 12 Function Description UPPER() converts a string to upper case. LOWER() converts a string to lower case. CONCAT() concatenates two string values. LENGTH() returns the length of the input string. SUBSTR() returns a portion of a string from a given start point to an end point Aggregate Functions: SQL aggregation function is used to perform the calculations on multiple rows of a single column of a table. It returns a single value. It is also used to summarize the data. Function Description COUNT() Count the number of rows in a database table. SUM() Calculates the sum of all selected columns. It works on numeric fields only. AVG() Calculate the average value of the numeric type. MAX() Finds the maximum value of a certain column MIN() Finds the minimum value of a certain column Login to mysql: 13 Display existing databases: Create a new database: 14 Entering into the created database: Display the tables in the selected database: Creating a table in selected database: 15 View the structure of the created table: Inserting data into the created table: 16 View inserted data from the table: Inserting multiple rows together: 17 Dislay the details of students who’s course is JSD: Dislay the details of students who’s course is JSD and mark greater than 80: 18 Display admno and name of all the students: 19 Unit 2 - Advanced Python Programming GUI PROGRAMMING IN PYTHON GUI or Graphical User Interface? It is a user centered design to accept input from user in friendly way Graphical icons such as buttons, scroll bars, windows, menus, text boxes are used to read inputs Some Python Libraries available to make GUIs are, Tkinter Flexx Pyside Kivi Pyforms PyGUI CEFPython What is Tkinter? A module in the Python standard library which serves as an interface to Tk(ToolKit). Widgets: Tkinter provides a variety of common GUI elements which we can use to build our interface – such as buttons, menus and various kinds of entry fields and display areas. We call these elements widgets. 4 steps to be followed in GUI programming: 1. Import the Tkinter module 2. Create the GUI application main window. 3. Add widgets to the GUI application. 4. Enter the main event loop to take action against each event triggered by the user How to import Tkinter module to python? from tkinter import * The above statement is to be added in the beginning section of the python program. 20 Create application Main window A container of widgets has to be created by using the following statement Tk( ) It calls a constructor of class Tk( ) in Tkinter module Now a window with the default title Tk is created. All the widgets are placed on it. The default title can be changed by using the following line of codes window=Tk() #Here window is an object of Tk window.title(“My title”) We can set the dimension of window by using the following line of codes window=Tk() window.geometry(“400x400”) To change background colour window.configure(bg=”red”) To make window non resizable window.resizable(height=False,width=False) Create Widgets and add it to the window 1.Label A label is created as follows l=Label( window, text=”This is the text shown on label”) #here window is the container on which the label is placed Some properties of Label are fg - to specify the colour of text bg - to set the background colour(label colour) width - to set width height - to set height Note: On creation of the widget, it won’t be displayed until it has been added to the window by any of the following methods o pack() o grid() o place() 21 The following lines of code create and display a label named ‘my label ‘ from tkinter import * window=Tk() l=Label( window, text=”my label”) l.pack() 2.MessageBox MessageboxWidget is used to display the message boxes in the python applications. Syntax: messagebox.Function_Name(title, message) Function_Name: Some functions or methods available in the messagebox widget are. 1. showinfo(): Show some relevant information to the user. 2. showwarning(): Display the warning to the user. 3. showerror(): Display the error message to the user title: This parameter is a string which is shown as a title of a message box. message: This parameter is the string to be displayed as a message on the message box. Eg:- messagebox.showinfo("showinfo", "Information") messagebox.showwarning("showwarning", "Warning") messagebox.showerror("showerror", "Error") 3.Button A button is created as follows #creates a button with caption ‘click’ button=Button( window, text=”click”) Some properties of Button are fg - to specify the colour of text bg - to set the background colour width - to set width height - to set height ❖ ‘click event handling of button’ (using the argument ‘command’ ) ‘command’ is associated with a function. #Calls a function when a button is clicked 22 Eg:- from tkinter import * def test( ): print(“Button clicked”) window=Tk() b=Button(window, text=”click” ,command=test) b.pack() window.mainloop( ) Note:- To show a message in messge box , we use ‘messagebox.showinfo( )’ from tkinter import * from tkinter import messagebox def test( ): messagebox.showinfo( “Title”,”Button clicked”) window=Tk() b=Button(window, text=”click” ,command=test) b.pack() window.mainloop( ) Note: b=Button(window, text=”click” ,command=window.destroy) This enables to exit window 4. Entry A text box to receive user input, can be created as follows e=Entry( ) Some properties of Entry are fg - to specify the colour of text bg - to set the background colour width - to set width height - to set height get( ) is used to access the text in Entry widget Eg:- from tkinter import * from tkinter import messagebox def test( ): t=e.get()#Entry value is accessed and assigned to t messagebox.showinfo( ‘Text inside Entry is’+ t) 23 window=Tk() e=Entry(window,fg=”red”) b=Button(window, text=”click” ,command=test) e.pack() b.pack() window.mainloop( ) 4.Canvas Canvas is a rectangular area intended to draw pictures and other complex layouts. We can place graphics,text,widgets on a canvas Syntax Canvas(parent,option=value) #parent is the window on which the widget is placed some options 1.bg - specifies the background colour 2.cursor- when cursor is entered on canvas the icon can be changed to arrow,circle, dot... 3.height - specifies the height of canvas 4.width - specifies the width of canvas Note:- create_line(),create_arc(),create_oval( ),create_rectangle() are used to draw line,oval(or circle),rectangle on a canvas The following creates a canvas and draws a red line on it from tkinter import * window=Tk() c=Canvas(window,bg=”blue”, height=200,width=200) c.create_line(0,0.200,200,fill=”red”) c.pack() window.mainloop( ) 24 The following creates a canvas and insert an image on it from tkinter import* window=Tk() c=Canvas(window,bg=”blue”, height=200,width=200) img=PhotoImage(file=”flower.png”) c.create_image(50,10,image=img,anchor=NW) c.pack() window.mainloop( ) 5.Checkbutton A checkbutton widget is used to display a number of options ,from which a user can select one or more options Syntax: c=Checkbutton(window,option=value) option can be.... 1. bg - To specify the background colour 2. fg - To specify the text colour 3. activebackground - Background colour when checkbutton is under cursor 4. activeforeground - Text colour whencheckbutton is under cursor 5. cursor - To change the pattern of cusor(dot,arrow,circle) 6. height - Specifies the height 7. width - Specifies the width 8. offvalue - The value to bet set when checkbutton is not selected (This value is set to control variable ) 9. onvalue - The value to bet set when checkbutton is checked 10. variable - It is a control variable associated with tkinter variable 11. command -It is associated with a function,called when the widget state is changed 25 Methods related to checkbutton select() - To check a checkbutton deselect() - To uncheck a checkbutton toggle() - To toggle the states Tkinter control variables Some widgets (like text entry widgets, radio buttons...) can be connected directly to application variables by using special options: variable,textvariable, onvalue, offvalue, and value If the variable changes for any reason, the widget it's connected to will be updated to reflect the new value It's not possible to hand over a regular Python variable to a widget through a variable or textvariable option. The only kinds of variables for which this works are variables that are subclassed from a class called Variable, defined in the Tkinter module. They are created as follows x=StringVar() x=IntVar() x=DoubleVar() x = BooleanVar() How to associate a Entry text with StringVar var=StringVar() #Here, textvariable is the control variable of Entry and is associated to var e=Entry(window,textvariable=var) How to associate a Label text with StringVar var=StringVar() #Here, textvariable is the control variable of Label and is associated to var l=Label(window,textvariable=var) #Program which sets the label caption with the text entered in the Entry widget on button click from tkinter import * def setval(): var2.set(var1.get()) window=Tk() window.geometry("300x300") var1=StringVar() var2=StringVar() 26 e=Entry(window,textvariable=var1) l=Label(window,textvariable=var2) b1=Button(window,text="Set",command=setval) e.pack() l.pack() b1.pack() window.mainloop() How to associate a Check button value with IntVar() var=IntVar() c=Checkbutton(window,text=”Music”,variable=var) from tkinter import * def setval(): if (var1.get() == 1) & (var2.get() == 0): l.config(text='You Love Music') elif (var1.get() == 0) & (var2.get() == 1): l.config(text=’You Love Dance’) elif (var1.get() == 1) & (var2.get() == 1): l.config(text='You Love Music&Dance') else: l.config(text='You Love neither' ) window = Tk() window.title('My Window') window.geometry('100x100') l = Label(window, bg='white', width=20) l.pack() var1 =IntVar() var2 = IntVar() c1 = Checkbutton(window, text='Music',variable=var1, onvalue=1, offvalue=0, command=setval) 27 c2 = Checkbutton(window, text='C++',variable=var2, onvalue=1, offvalue=0, command=setval) c1.pack() c2.pack() window.mainloop() 6. Radiobutton This widget implements a multiple-choice button, which is a way to offer many possible selections to the user and lets user choose only one of them. In order to implement this functionality, each group of radiobuttons must be associated to the same variable syntax r= Radiobutton( rootwindow, option,... ) options can be... 1. activebackground- The background color when the mouse is over the radiobutton. 2. activeforeground-The foreground color when the mouse is over the radiobutton. 3.bg -The normal background color behind the indicator and label. 4. fg -The color of the text. 5. height - The number of lines (not pixels) of text on the radiobutton. Default is 1. 6. width -Width of the label in characters (not pixels) 7. selectcolor- The color of the radiobutton when it is set. Default is red. 8. value - When a radiobutton is turned on by the user, its control variable is set to its current value option 9.variable :The control variable that this radiobutton shares with the other radiobuttons in the group methods select() - Sets (turns on) the radiobutton. deselect() - Clears (turns off) the radiobutton 28 Example from tkinter import * from functools import partial def sel(): selection = "You selected the option " + str(var.get()) label.config(text = selection) window = Tk() var = IntVar() R1 = Radiobutton(window , text="Option 1", variable=var, value=1,command=sel) R1.pack( ) R2 = Radiobutton(window, text="Option 2", variable=var, value=2, command=sel) R2.pack( ) R3 = Radiobutton(window, text="Option 3", variable=var, value=3, command=sel) R3.pack( ) label = Label(window) label.pack() window.mainloop() 7.Listbox The Listbox widget is used to display a list of items from which a user can select a number of items. syntax listbox= Listbox( rootwindow, option,... ) options can be... 1. bg -The normal background color behind the indicator and label. 2. bd-The size of the border around the indicator. Default is 2 pixels. 3. fg -The color of the text in listbox 29 4. font -The font used for the text in the listbox.. 5. height - The number of lines (not pixels) of text on the Listbox. Default is 10. 6. width- The width of the widget in characters. The default is 20. 7. selectmode - BROWSE− Normally, you can only select one line out of a listbox. If you click on an item and then drag to a different line, the selection will follow the mouse. This is the default SINGLE− You can only select one line, and you can't drag the mouse. MULTIPLE− You can select any number of lines at once. Clicking on any line toggles whether or not it is selected. EXTENDED− You can select any adjacent group of lines at once by clicking on the first line and dragging to the last line. 8. selectbackground - The background color to use displaying selected text. Methods 1. delete ( first, last ) - delete the items in the list box ( index ranges from first number (index) to last index specified). Index values in list box starts from 0 Eg:- list. delete(0,3) - deletes 4 items at index values 0,1,2,3 delete(ANCHOR) – delete the selected item 2.insert ( index, *elements ) - Insert one or more new lines into thelistbox before the line specified by index. Use END as the first argument if you wantto add new lines to the end of the listbox. Eg:- To add 2 items to the beginning of list list.insert(0,”first item”,”second item”) To add 2 items at the end of of list list.insert(END,”item1”,”item2”) 3.size( ) - Returns the number of lines in the listbox 4.get ( first, last) -Returns a tuple containing the text of the lines with indices from first to last, inclusive. Eg:-To get first 3 items 30 list.get(0,2) #List box program from tkinter import * def del1(): listbox.delete(ANCHOR) def ins(): item=e.get() listbox.insert(END,item) def disp(): print(listbox.get(0,END)) window = Tk() window.geometry("800x600") lbl = Label(window,text = "A list of favourite countries...") e=Entry(window) e.pack() listbox = Listbox(window,selectmode=EXTENDED) listbox.insert(1,"India") listbox.insert(2, "USA") listbox.insert(3, "Japan") #this button will delete the selected item from the list btn1=Button(window, text = "delete",command=del1) #this button will insert the item in the Entry to the end of listbox btn2=Button(window, text = "insert",command=ins) #this button will display a tuple containing all items in the list btn3=Button(window, text = "display",command=disp) lbl.pack() listbox.pack() btn1.pack() btn2.pack() 31 btn3.pack() window.mainloop() combobox A combobox widget allows you to select one value in a set of values. To Create a combobox To create a combobox widget, you’ll use the ttk.Combobox() constructor. Note:- ttk is to be imported as, from tkinter import ttk The following example creates a combobox widget and links it to a string variable var = tk.StringVar() combobox = ttk.Combobox(container, textvariable=var) # The container is the window or frame on which you want to place the combobox widget. #The textvariable argument links a variable var to the current value of the combobox. To access current selected value value = combobox.get() To add items to combo box The combobox has the values property that you can assign a list of values combobox['values'] = ('value1', 'value2', 'value3') Layout management in Tkinter In Tkinter there are three types of layout managers -- pack , place , and grid. 32 PYTHON FILES Files are named locations on disk to store related information. They are used to permanently store data in a non-volatile memory (e.g. hard disk). When we want to read from or write to a file, we need to open it first. When we are done, it needs to be closed so that the resources that are tied with the file are freed. Hence, in Python, a file operation takes place in the following order: Open a file Read or write (perform operation) Close the file Opening Files in Python Python has a built-in open() function to open a file. This function returns a file object, also called a handle, as it is used to read or modify the file accordingly. f = open("test.txt") # open file in current directory f = open("C:/Python38/README.txt") # specifying full path We can specify the mode while opening a file. In mode, we specify whether we want to read r, write w or append a to the file. Mod Description e r Opens a file for reading. (default) w Opens a file for writing. Creates a new file if it does not exist or truncates the file if it exists. x Opens a file for exclusive creation. If the file already exists, the operation fails. Opens a file for appending at the end of the file without truncating it. Creates a new file if it a does not exist. Closing Files in Python When we are done with performing operations on the file, we need to properly close the file.Closing a file will free up the resources that were tied with the file. It is done using the close() method available in Python. f = open("test.txt", encoding = 'utf-8') # perform file operations f.close() 33 Writing to Files in Python In order to write into a file in Python, we need to open it in write w, append a or exclusive creation x mode. We need to be careful with the w mode, as it will overwrite into the file if it already exists. Due to this, all the previous data are erased. f=open("test.txt",'w') f.write("my first file\n") f.write("This file\n\n") f.write("contains three lines\n") f.close() Reading Files in Python To read a file in Python, we must open the file in reading r mode. f = open("test.txt",'r') f.read() f.close() Alternatively, we can use the readline() method to read individual lines of a file. This method reads a file till the newline, including the newline character. f = open("test.txt",'r') f.readline() f.close() Python Errors and Built-in Exceptions We can make certain mistakes while writing a program that lead to errors when we try to run it. A python program terminates as soon as it encounters an unhandled error. These errors can be broadly classified into two classes: 1. Syntax errors 2. Exceptions Python Syntax Errors Error caused by not following the proper structure (syntax) of the language is called syntax error or parsing error. Let's look at one example: if a < 3 File "", line 1 if a < 3 ^ SyntaxError: invalid syntax As shown in the example, an arrow indicates where the parser ran into the syntax error. We can notice here that a colon : is missing in the if statement. 34 Exceptions Errors that occur at runtime (after passing the syntax test) are called.Whenever these types of runtime errors occur, Python creates an exception object. If not handled properly, it prints a traceback to that error along with some details about why that error occurred. Exception Cause of Error IndexError Raised when the index of a sequence is out of range. NameError Raised when a variable is not found in local or global scope. TypeError Raised when a function or operation is applied to an object of incorrect type. ValueError Raised when a function gets an argument of correct type but improper value. ZeroDivisionError Raised when the second operand of division or modulo operation is zero. IndentationError Raised when there is incorrect indentation. 35 SOFTWARE ENGINEERING INTRODUCTION TO SOFTWARE ENGINEERING The term software engineering is composed of two words, software and engineering. Software is more than just a program code. A program is an executable code, which serves some computational purpose. Software is considered to be a collection of executable programming code, associated libraries and documentations. Software, when made for a specific requirement is called a software product. Engineering on the other hand, is all about developing products, using well-defined, scientific principles and methods. So, we can define software engineering as an engineering branch associated with the development of software product using well-defined scientific principles, methods and procedures. The outcome of software engineering is an efficient and reliable software product. IEEE defines software engineering as: The application of a systematic, disciplined, quantifiable approach to the development, operation and maintenance of software. Software Products: Software Products are nothing but software systems delivered to the customer with the documentation that describes how to install and use the system. In certain cases, software products may be part of system products where hardware, as well as software, is delivered to a customer. Software products are produced with the help of the software process. The software process is a way in which we produce software. NEED OF SOFTWARE ENGINEERING The need of software engineering arises because of a higher rate of change in user requirements and environment on which the software is working. CHARACTERISTICS OF GOOD SOFTWARE A software product can be judged by what it offers and how well it can be used. This software must satisfy on the following grounds: Operational Transitional Maintenance SOFTWARE DEVELOPMENT LIFE CYCLE (SDLC) A software development life cycle model (also called process model) is a descriptive and diagrammatic representation of the software life cycle. A life cycle model represents all the activities required to make a software product transit through its life cycle phases. Different software life cycle models 36 Many life cycle models have been proposed so far. Each of them has some advantages as well as some disadvantages. A few important and commonly used life cycle models are as follows: ⇨ Waterfall Model => Agile Model Waterfall Model: This model was describe about the SDLC process. This is the oldest software development model. Waterfall model is very easy to understand. In the waterfall model has many phase. In this model all the phase are step by step completed. Means if the first stage completed then the next steps comes. It doesn’t go to return previous steps. Here we read all the process step by step. Requirement -: For creating any software or process of development it is necessary to know what are the requirement to developing of any software. User requirement is necessary to know for developing any software. First collect all information about the software requirement and analysis the information. Design -: After the collecting the information the next steps comes to create the design of any software. For creating a design of software keep the mind for user requirement. Design give the SRS document into a structure that is suitable for implementation in programming language. 37 Development -: After creating a design the next steps comes for development means create a source code of into programming language. In this steps all the code are written in special language that you are using Testing -: After writing the code the next steps comes for software testing. Testing play a very important role in SDLC process. It is necessary to know the software you are created that is working or not working. What are the error comes in the software when we are using. Deployment –: After the testing the next steps comes deployment. After the testing the product is deployed in the customer environment or released into the market. Maintenance -: This is the last steps of waterfall model.If there are necessary to create any part of software this process comes If any issues comes in software using the client. Then fix those issues, patches are released. Also to enhance the product some better versions are released. Maintenance is done to deliver these changes in the customer environment. Agile Development Model: In the Agile model, the requirements are decomposed into many small parts that can be incrementally developed. The Agile model adopts Iterative development. Each incremental part is developed over an iteration. Each iteration is intended to be small and easily manageable and that can be completed within a couple of weeks only. At a time one iteration is planned, developed and deployed to the customers. Long-term plans are not made. Phases of Agile Model: Following are the phases in the Agile model are as follows: 1. Requirements gathering 2. Design the requirements 3. Construction/ iteration 4. Testing/ Quality assurance 5. Deployment 6. Feedback 1. Requirements gathering: In this phase, you must define the requirements. You should explain business opportunities and plan the time and effort needed to build the project. Based on this information, you can evaluate technical and economic feasibility. 38 2. Design the requirements: When you have identified the project, work with stakeholders to define requirements. You can use the user flow diagram or the high-level UML diagram to show the work of new features and show how it will apply to your existing system. 3. Construction/ iteration: When the team defines the requirements, the work begins. Designers and developers start working on their project, which aims to deploy a working product. The product will undergo various stages of improvement, so it includes simple, minimal functionality. 4. Testing: In this phase, the Quality Assurance team examines the product's performance and looks for the bug. 5. Deployment: In this phase, the team issues a product for the user's work environment. 6. Feedback: After releasing the product, the last step is feedback. In this, the team receives feedback about the product and works through the feedback. MANAGEMENT INFORMATION SYSTEMS (MIS) Management Information System (MIS) is one of the five major Computer Based Information Systems (CBIS). Its purpose is to meet the general information needs of the managers in firm or organization. MIS is a computer based system that makes information available to users with similar needs. Management Information System (MIS) consists of following three pillars: Management, Information and System. These are explained as following below 1. Management: art of getting things done through and with the people of in formally organized groups. Managerial functions: (i) Panning (ii) Organizing (iii) Staffing (iv) Directing (v) Controlling 2. Information: data that have a meaning with a context, where data is raw facts about an entity (entity is the object of interest). 3. System: set of inter-related components with a clearly defined boundary working together to achieve a common goal. Importance of MIS: It may be a student aspiring to become a manager in some organisation, an entrepreneur or a professional. Information system and information technology is a vital component of any successful business and is regarded as a major functional area like any other functional area of a business organization like marketing, finance, production, human resources (HR) etc. Information systems play following 3 vital roles for a business organisation: 1. Supports the business processes and operations of an organisation. 39 2. Support of decision making by employees and managers of an organisation. 3. Support the strategies of an organisation for competitive advantage. Advantages of MIS: Improves quality of an organization or an information content by providing relevant information for sound decision making. MIS change large amount of data into summarize form and thereby avoid confusion which may an answer when an information officer are flooded with detailed fact. MIS facilitates integration of specialized activities by keeping each department aware of problem and requirements of other departments. MIS serves as a link between managerial planning and control. Disadvantages of MIS: Too rigid and difficult to adapt. Resistance in sharing internal information between departments can reduce the effectiveness. Hard to quantify benefit to justify implementation of MIS. Quality of output of an MIS is directly proportional to quality of input and processes. PROGRAM TESTING Testing a program consists of providing the program with a set of test inputs (or test cases) and observing if the program behaves as expected. If the program fails to behave as expected, then the conditions under which failure occurs are noted for later debugging and correction. Aim of Testing The aim of the testing process is to identify all defects existing in a software product. However for most practical systems, even after satisfactorily carrying out the testing phase, it is not possible to guarantee that the software is error free. This is because of the fact that the input data domain of most software products is very large. It is not practical to test the software exhaustively with respect to each value that the input data may assume. Even with this practical limitation of the testing process, the importance of testing should not be underestimated. It must be remembered that testing does expose many defects existing in a software product. Thus testing provides a practical way of reducing defects in a system and increasing the users’ confidence in a developed system. Verification Vs Validation 40 Verification is the process of determining whether the output of one phase of software development conforms to that of its previous phase, whereas validation is the process of determining whether a fully developed system conforms to its requirements specification. Thus while verification is concerned with phase containment of errors, the aim of validation is that the final product be error free. SOFTWARE TESTING LIFE CYCLE STLC stands for Software Testing Life Cycle. STLC is a sequence of different activities performed by the testing team to ensure the quality of the software or the product. Six Major STLC Phases 1. Requirements Analysis 2. Test Planning 3. The Case Designing 4. Test Environment Setup 5. Test Case Execution 6. Test Cycle Closure Requirement Analysis − When the SRD is ready and shared with the stakeholders, the testing team starts high level analysis concerning the AUT (Application under Test). Test Planning − Test Team plans the strategy and approach. Test Case Designing − Develop the test cases based on scope and criteria’s. Test Environment Setup − When integrated environment is ready to validate the product. Test Case Execution − Real-time validation of product and finding bugs. Test Cycle Closure − Once testing is completed, matrix, reports, results are documented. TYPES OF SOFTWAE TESTING: 41 1. Unit Testing It focuses on the smallest unit of software design. In this, we test an individual unit or group of interrelated units. It is often done by the programmer by using sample input and observing its corresponding outputs. 2. Integration Testing The objective is to take unit tested components and build a program structure that has been dictated by design. Integration testing is testing in which a group of components is combined to produce output. Integration testing is of four types: (i) Top-down (ii) Bottom-up (iii) Sandwich (iv) Big-Bang 3. System Testing This software is tested such that it works fine for the different operating systems. It is covered under the black box testing technique. In this, we just focus on the required input and output without focusing on internal working. In this, we have security testing, recovery testing, stress testing, and performance testing. 4. Acceptance Testing It is a formal testing according to user needs, requirements and business processes conducted to determine whether a system satisfies the acceptance criteria or not and to enable the users, customers or other authorized entities to determine whether to accept the system or not. Acceptance Testing is the last phase of software testing performed after System Testing and before making the system available for actual use. Alpha, Beta, and Gamma Testing There are three phases of software testing - alpha, beta, and gamma. They are performed one after another, and together ensure a release of high-quality software. 42 Alpha Testing: Alpha testing is an internal checking done by the in-house development or QA team. Its main purpose is to discover software bugs that were not found before. At the stage of alpha testing, software behavior is verified under real-life conditions by imitating the end-users’ actions. It enables us to get fast approval from the customer before proceeding to product delivery. Beta Testing: Beta testing can be called pre-release testing. It can be conducted by a limited number of end-users called beta testers before the official product delivery. The main purpose of beta testing is to verify software compatibility with different software and hardware configurations, types of network connection, and to get the users’ feedback on software usability and functionality. Gamma Testing: Gamma testing is the final stage of the testing process conducted before software release. It makes sure that the product is ready for market release according to all the specified requirements. Gamma testing focuses on software security and functionality. But it does not include any in-house QA activities. During gamma testing, the software does not undergo any modifications unless the detected bug is of a high priority and severity. 43 Software Testing Tools 1. Selenium 2. Appium 3. Katalon 4. Cucumber 5. HPE Unified Functional Testing (UFT) What is software? Software is a set of instructions, data or programs used to operate computers and execute specific tasks. The two main categories of software are application software and system software. What is the main difference between a computer program and computer software? A computer program is a piece of programming code. It performs a well-defined task. On the other hand, the software includes programming code, documentation and user guide. What is software engineering? Software engineering is the systematic application of engineering approaches to the development of software. Describe the software development process in brief? The software development is a life cycle is composed of the following stages: ⮚ Requirement analysis ⮚ Design ⮚ Development ⮚ Testing ⮚ Deployment ⮚ Maintenance List any two SDLC models available? ⮚ Waterfall Model ⮚ Agile Model What are software requirements? Software requirements are a functional description of a proposed software system. It is assumed to be the description of the target system, its functionalities, and features. What are functional and non-functional requirements? Functional requirements are functional features which are expected by users from the proposed software product. 44 Non-functional requirements are related to security, performance, look, and feel of the user interface. What is verification and validation? Verification: Verification is a term that refers to the set of activities which ensure that software implements a specific function. Validation: It refers to the set of activities which ensure that software that has been built according to the need of clients. In software development process what is the meaning of debugging? Debugging is the process that results in the removal of error. It is very important part of the successful testing. What is the difference between stack and queue? Queue is always First In, First Out Stack is always Last In, First Out What is SDLC? SDLC is a systematic process for building software that ensures the quality and correctness of the software built. SDLC process aims to produce high-quality software that meets customer expectations. SDLC stands for Software Development Life Cycle and is also referred to as the Application Development life-cycle. Difference between CRS and SRS CRS SRS CRS stands for Customer Requirement SRS stands for System Requirement Specification. Specification. It is Business Requirement Specification It is Functional Specification This document is provided by Customer, which This document is contains details about contains detailed information about customer system modules and their functionality. Business. What is Waterfall Model? It is also referred to as a linear-sequential life cycle model. In a waterfall model, each phase must be completed before the next phase can begin and there is no overlapping in the phases. 45 What is Agile Model? Agile SDLC model is a combination of iterative and incremental process models with focus on process adaptability and customer satisfaction by rapid delivery of working software product. In Agile, the tasks are divided to time boxes (small time frames) to deliver specific features for a release. 46 What is Software Testing? Software Testing is a method to check whether the actual software product matches expected requirements and to ensure that software product is Defect free. The purpose of software testing is to identify errors, gaps or missing requirements in contrast to actual requirements. What is STLC? Explain? STLC stands for Software Testing Life Cycle. STLC is a sequence of different activities performed by the testing team to ensure the quality of the software or the product. Six Major STLC Phases 1. Requirements Analysis 2. Test Planning 3. The Case Designing 4. Test Environment Setup 5. Test Case Execution 6. Test Cycle Closure What are different types of software testing? 1. Unit Testing It focuses on the smallest unit of software design. In this, we test an individual unit or group of interrelated units. 2. Integration Testing The objective is to take unit tested components and build a program structure that has been dictated by design. Integration testing is testing in which a group of components is combined to produce output. 3. System Testing This software is tested such that it works fine for the different operating systems. It is covered under the black box testing technique. In this, we just focus on the required input and output without focusing on internal working. 4. Acceptance Testing 47 It is a formal testing according to user needs, requirements and business processes conducted to determine whether a system satisfies the acceptance criteria or not and to enable the users, Explain Alpha, Beta, and Gamma Testing? There are three phases of software testing - alpha, beta, and gamma. They are performed one after another, and together ensure a release of high-quality software. Alpha testing is an internal checking done by the in-house development or QA team. At the stage of alpha testing, software behavior is verified under real-life conditions by imitating the end-users’ actions. Beta testing can be called pre-release testing. It can be conducted by a limited number of end-users called beta testers before the official product delivery. The main purpose of beta testing is to verify software compatibility with different software and hardware configurations, types of network connection, and to get the users’ feedback on software usability and functionality. Gamma testing is the final stage of the testing process conducted before software release. It makes sure that the product is ready for market release according to all the specified requirements. What is White Box Testing? White Box Testing is software testing technique in which internal structure, design and coding of software are tested to verify flow of input-output and to improve design, usability and security. In white box testing, code is visible to testers so it is also called Clear box testing, Open box testing, Transparent box testing, Code-based testing and Glass box testing. What is Black Box Testing? Black Box Testing is a software testing method in which the functionalities of software applications are tested without having knowledge of internal code structure, implementation details and internal paths. Black Box Testing mainly focuses on input and output of software applications and it is entirely based on software requirements and specifications. It is also known as Behavioral Testing. What is software testing tool? List any four testing tools available? 48 Software testing tools are applications that can be used to assist developers and testers in performing manual or automated tests. ⮚ Selenium ⮚ Appium ⮚ Cucumber ⮚ HPE Unified Functional Testing (UFT) Define ISO Standards in Software Engineering? The mission of the International Standard Organization is to market the development of standardization and its related activities to facilitate the international exchange of products and services. Eg: ISO 9003: 1994, ISO/IEC 9075-13: 2002, ISO/IEC 25000:2005 etc Objective Questions: 1) What is the first step in the software development lifecycle? a) System Design b) Coding c) System Testing d) Preliminary Investigation and Analysis 2) Software is defined as ___________ a) set of programs, documentation & configuration of data b) set of programs c) documentation and configuration of data d) None of the mentioned 3) What is a Functional Requirement? a) specifies the tasks the program must complete b) specifies the tasks the program should not complete c) specifies the tasks the program must not work d) All of the mentioned 4) Who is the father of Software Engineering? a) Margaret Hamilton b) Watts S. Humphrey c) Alan Turing d) Boris Beizer 5) Which one of the following activities is not recommended for software processes in software engineering? a) Software Evolution b) Software Verification c) Software Testing & Validation d) Software designing 49 6) The agile software development model is built based on __________. a) Linear Development b) Incremental Development c) Iterative Development d) Both Incremental and Iterative Development 7) Attributes of good software is ____________ a) Development b) Maintainability & functionality c) Functionality d) Maintainability 8) What does SDLC stands for? a) System Design Life Cycle b) Software Design Life Cycle c) Software Development Life Cycle d) System Development Life cycle 9) Which of the following is not a valid phase of SDLC (Software Development Life Cycle)? a) Testing Phase b) Requirement Phase c) Deployment phase d) Testing closure 10) Which of the following testing is also known as white-box testing? a) Structural testing b) Error guessing technique c) Design based testing d) None of the above EMERGING TRENDS AND SOCIAL IMPACT Technology is ever-changing and those wanting to remain at the help of innovation must adapt. Technology has been growing so exponentially over recent years, there has been a steadily increasing demand for bright graduates to come in and help to transform areas ranging from data infrastructure to cyber security. As tech trends such as artificial intelligence (AI) and robotic process automation (RPA) become more pervasive, the world will look to brands who can deliver with accuracy and real-time efficiency.11 27 31 Machine Learning: Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine learning focuses on the development of computer programs that can access data and use it to learn for themselves. The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in 50 the future based on the examples that we provide. The primary aim is to allow the computers learn automatically without human intervention or assistance and adjust actions accordingly. Types of Machine Learning One of the important topics in machine learning is the types of machine learning. The four primary types of learning and along with their respective algorithms available as follows: ⮚ Supervised Learning ⮚ Semi-Supervised Learning ⮚ Unsupervised Learning ⮚ Reinforcement Learning Internet of Things (IoT) The Internet of Things (IoT) is the network of physical objects-devices, vehicles, buildings and other items-embedded with electronics, software, sensors, and network connectivity that enables these objects to collect and exchange data. The IoT allows objects to be sensed and controlled remotely across existing network infrastructure, creating opportunities for more direct integration of the physical world into computer based systems, and resulting in improved efficiency, accuracy and economic benefit. Each thing is uniquely identifiable through its embedded computing system but is able to interoperate within the existing Internet infrastructure. Experts estimate that the IoT will consist of almost 50 billion objects by 2020. IoT is expected to offer advanced connectivity of devices, systems, and services that goes beyond machine-to-machine (M2M) communications and covers a variety of protocols, domains, and applications."Things," in the IoT sense, can refer to a wide variety of devices such as heart monitoring implants, biochip transponders on farm animals, electric clams in coastal waters, automobiles with built-in sensors, DNA analysis devices for environmental/food/pathogen monitoring or field operation devices that assist fire fighters in search and rescue operations. Based on the application domain, IoT products can be classified broadly into five different categories such as, ⮚ smart wearable ⮚ smart home ⮚ smartcity ⮚ smart environment ⮚ smart enterprise Artificial intelligence: Artificial intelligence (AI) makes it possible for machines to learn from experience, adjust to new inputs and perform human-like tasks. Most AI examples that you hear about today – from chess-playing computers to self-driving cars – rely heavily on deep learning and natural language processing. Using these technologies, computers can be trained to accomplish specific tasks by processing large amounts of data and recognizing patterns in the data. The traditional goals of AI research include reasoning, knowledge representation, planning, learning, natural language processing, perception, and the ability to move and manipulate objects. Artificial intelligence (AI) is the intelligence exhibited by machines or software. Ultimate AI would be a recreation of the human thought process -- a man-made machine with our intellectual abilities. This would include the ability to learn just about anything, the ability to reason, the ability to use language and the ability to formulate original ideas. The real challenge of AI is to understand how natural intelligence works. Developing AI isn't like 51 building an artificial heart -- scientists don't have a simple, concrete model to work from. We do know that the brain contains billions and billions of neurons, and that we think and learn by establishing electrical connections between different neurons. But we don't know exactly how all of these connections add up to higher reasoning, or even low-level operations. The complex circuitry seems incomprehensible. Applications of Artificial intelligence (AI) Medical Diagnosis Artificial intelligence (AI) has been used in a wide range of fields including medical diagnosis, stock trading, robot control, law, remote sensing, scientific discovery and toys. Artificial neural networks are used as clinical decision support systems for medical diagnosis, such as in Concept Processing technology in EMR software. Another application in medical science is the detection of a tumour. Knowledge Engineering A field within artificial intelligence (AI) that develops knowledge-based systems. Such systems are computer programs that contain large amounts of knowledge, rules and reasoning mechanisms to provide solutions to real-world problems. A major form of knowledge-based system is an expert system, one designed to emulate the reasoning processes of an expert practitioner (i.e. one having performed in a professional role for very many years).One of the first examples of an expert system was MYCIN, an application to perform medical diagnosis. In the MYCIN example, the domain experts were medical doctors and the knowledge represented was their expertise in diagnosis. Natural Language Processing Natural language processing (NLP) is a field of computer science, artificial intelligence (AI), and computational linguistics concerned with the interactions between computers and human (natural) languages. Some of the most commonly researched tasks in NLP are Automatic summarization, Machine translation, Natural language generation, Question answering, Speech recognition, Speech processing etc. Other tasks include Native Language Identification, Text simplification, Text-to-speech, Text-proofing, Query expansion etc. Robotics Artificial Intelligence (AI) is the most exiting field in Robotics. Robotics deal with automated machines that can take the place of humans in dangerous environment or manufacturing process. It resembles humans in appearance and behavior and uses the Artificial Intelligent techniques. Cyber security: Cyber security is the protection of information systems from theft or damage to the hardware, the software, and to the information on them as well as from disruption or misdirection of the services they provide. Governments, military, corporations, financial institutions, hospitals and other businesses collect, process and store a great deal of confidential information on computers and transmit that data across networks to other computers. With the growing volume of cyber attacks, ongoing attention is required to protect sensitive business and personal information, as well as safeguard national security. Cybercrime: Cybercrime, is crime that involves a computer and a network. In some cases, the computer may have been used in order to commit the crime, and in other cases, the computer may have been the target of the crime. 52 Types of Cyber crime: Common cyber crimes are as follows: Child Abuse or Exploitation: It involves the use of computer networks to create, distribute, or access materials that sexually exploit underage children. Computer Intrusion/Hacking: A hacker is an unauthorized user who attempts to or gains access to an information system. It is an attack in to the privacy of data. Cracking: It is a dreadful feeling to know that a stranger has broken into user computer systems without user's knowledge and consent and has tampered with precious confidential data and information. Cracker are differ with hacker because hacker are hired by companies to audit network security or test software but cracker do same work for their own profit or to harm others. Credit Card Fraud (Carding): It means false ATM cards i.e. Debit and Credit cards used by criminals for their monetary benefits through withdrawing money from the victim's bank account. E-Mail/SMS Spoofing: A spoofed E-mail/ SMS may be said to be one, which misrepresents its origin. It shows its origin to be different from which actually it originates. Here an offender steals identity of another in the form of email address, mobile phone number etc and send message via internet Phishing: Phishing means acquire information such as usernames, passwords, credit card details, personal detail etc by electronic communication. Phishing commonly uses fake emails or fake messages which contain link of virus/ malware infected fake websites. These websites request user to enter their personal detail. Software Piracy: It is an illegal reproduction and distribution of software for business or personal use. This is considered to be a type of infringement of copy right and a violation of a license agreement. Since the unauthorized user is not a party to the license agreement it is difficult to find out remedies. Denial-of-service Attack: Denial-of-service referred the act by which a user of any website or service denied to the use of service of the website. Child pornography: Which includes the creation, distribution, or accessing of materials that sexually exploit underage children Information Technology Act: The Information Technology Act, 2000 (also known as ITA-2000, or the IT Act) is an Act of the Indian Parliament notified on 17 October 2000. It is the primary law in India dealing with cybercrime and electronic commerce. The Information Technology Act, 2000 was amended in 2008. What is Blockchain? A blockchain is a digitally distributed, decentralized, public ledger that exists across a network. A blockchain is a distributed database that is shared among the nodes of a computer network. As a database, a blockchain stores information electronically in digital format. Blockchains are best known for their crucial role in cryptocurrency systems, such as Bitcoin, for maintaining a secure and decentralized record of transactions. The innovation with a blockchain is that it guarantees the fidelity and security of a record of data and generates trust without the need for a trusted third party. 53 Key elements of a Blockchain Distributed ledger technology:-All network participants have access to the distributed ledger and its immutable record of transactions. With this shared ledger, transactions are recorded only once, eliminating the duplication of effort that’s typical of traditional business networks. Immutable records:-No participant can change or tamper with a transaction after it’s been recorded to the shared ledger. If a transaction record includes an error, a new transaction must be added to reverse the error, and both transactions are then visible. Smart contracts:-To speed transactions, a set of rules — called a smart contract — is stored on the blockchain and executed automatically. A smart contract can define conditions for corporate bond transfers, include terms for travel insurance to be paid and much more. What is social engineering? Social engineering is the term used for a broad range of malicious activities accomplished through human interactions. It uses psychological manipulation to trick users into making security mistakes or giving away sensitive information. Social engineering attacks happen in one or more steps. A perpetrator first investigates the intended victim to gather necessary background information, such as potential points of entry and weak security protocols, needed to proceed with the attack. Then, the attacker moves to gain the victim’s trust and provide stimuli for subsequent actions that break security practices, such as revealing sensitive information or granting access to critical resources. Social Engineering Attack Lifecycle What is Data Analytics? 54 As the process of analyzing raw data to find trends and answer the questions, the definition of data analytics captures its broad scope of the field. However, it includes many techniques with many different goals. The data analytics process has some components that can help a variety of initiatives. By combining these components, a successful data analytics initiative will provide a clear picture of where you are, where you have been and where you should go. Descriptive Analytics: Generally, this process begins with descriptive analytics. This is the process of describing historical trends in data. Descriptive analytics aims to answer the question “what happened?” This often involves measuring traditional indicators such as return on investment (ROI). The indicators used will be different for each industry. Descriptive analytics does not make predictions or directly inform decisions. It focuses on summarizing data in a meaningful and descriptive way. Advanced Analytics: The next essential part of data analytics is advanced analytics. This part of data science takes advantage of advanced tools to extract data, make predictions and discover trends. These tools include classical statistics as well as machine learning. Machine learning technologies such as neural networks, natural language processing, sentiment analysis and more enable advanced analytics. This information provides new insight from data. Advanced analytics addresses “what if?” questions. The availability of machine learning techniques, massive data sets, and cheap computing power has enabled the use of these techniques in many industries. The collection of big data sets is instrumental in enabling these techniques. Big data analytics enables businesses to draw meaningful conclusions from complex and varied data sources, which has been made possible by advances in parallel processing and cheap computational power. What is Intellectual Property (IP)? Intellectual property (IP) refers to any intellectual creation, such as literary works, artistic works, inventions, designs, symbols, names, images, computer code, etc. Intellectual property (IP) law exists in order to protect the creators and covers areas of copyright, trademark law, and patents. Thus, intellectual property (IP) is an umbrella term encompassing both copyright and industrial property, such as trademarks, patents, and inventions. 55 What is copyright? Copyright is a form of Intellectual Property (IP). The U.S. Copyright Office defines copyright as A set of exclusive rights awarded to a copyright holder or owner for an original and creative work of authorship fixed in a tangible medium of expression. A limited statutory monopoly that gives a copyright holder the sole right to market a work for a limited period of time. Copyright also includes exemptions that permit a user of the copyright-protected work the right to exercise an exclusive right without authorization or royalty payment under certain conditions. What is Industrial Property? Industrial Property is a form of intellectual property that includes inventions, patents, trademarks, industrial designs, and geographical indications of source (i.e., products that are closely identified with their geographical places of origin). What is a Carbon Footprint? A Carbon Footprint is the total amount of greenhouse gases (including carbon dioxide and methane) that are generated by our actions. The average carbon footprint for a person in the United States is 16 tons, one of the highest rates in the world. Globally, the average carbon footprint is closer to 4 tons. To have the best chance of avoiding a 2℃ rise in global temperatures, the average global carbon footprint per year needs to drop to under 2 tons by 2050. Objective Questions: 1.Widely used and effective machine learning algorithm based on the idea of bagging is a) Regression b) Classification c) Decision Tree d) Random Forest 2. Machine Learning is a field of AI consisting of learning algorithms that.............. a) At Executing some task b) Over time with experience c) Improve their performance d) All the above 56 3.An IoT network is a collection of ______ devices a) Signal b) Machine to Machine c) Interconnected d) Network to Network 4.Artificial Intelligence is about_____. a) Playing a game on Computer b) Making a machine Intelligent c) Programming on Machine with your Own Intelligence d) Putting your intelligence in Machine 5. Who is known as the -Father of AI"? a) Fisher Ada b) Alan Turing c) John McCarthy d) Allen Newell 6. In a phishing, attackers target the ________ technology to so social engineering. a) Email b) Wi-Fi Netork c) Operating System d) Surveillance camera 7. What does P2P stand for? a) Password to Password b) Peer to Peer c) Product to Product d) Private Key to Public Key 8. What is a node in blockchain? a) A type of cryptocurrency b) A Blockchain c) A computer on a Blockchain network d) An exchange 9. Under which section of Information Technology Act of 2000, updated in 2008, stealing any digital asset or information is considered as cyber crime? a) 65 b) 65D 57 c) 67 d) 70 10. Which is the Act which provides legal framework for e-Governance in India? a) IT (amendment) Act 2008 b) Indian Penal Code c) IT Act 2000 d) None of these 58