top of page

Search Results

25 items found for ""

  • Data Mining Lab Manual BCA sem.-4 (SOU)

    Subject : Data Mining Lab Manual BCA Sem.-4 Model: 1 Experiment No.: 1 Aim : Create an Employee Table with the help of Data Mining Tool WEKA. Description: We need to create an Employee Table with a training data set which includes attributes like name, id, salary, experince, gender, phone number. Procedure: Steps: Open Start ➡️ Programs ➡️ Accessories ➡️ Notepad. Type the following training data set with the help of notepad for employee table. a. relation employee a. attribute name {x,y,z,a,b} a. attribute id numeric a. attribute salary (low, medium, high) a. attribute exp numeric a. attribute gender (male, female) a. attribute phone numeric a. Data: x, 101, low, 2, male, 250311 y, 102, high, 3, female, 251665 z, 103, medium, 1, male, 240238 a, 104, low, 5, female, 20020 b, 104, high, 2, male, 240240 that the file is saved with add file format. 2. Minimize the add file and than open start ➡️ program ➡️ WEKA -3-4 Click on WEKA -3-4 then WEKA dialogue box is displayed on the screen. In that dialogue box there are four modes click on explorer. Explorer shows many options In that click on open file and select the file.. Click on edit button which shows employee table on WEKA. Experiment No.: 2 Aim: Create a Weather Table with the help of Data Mining Tool WEKA. Description: We need to create a Weather table with training data set which includes attributes like, outlook, temperature, humidity, windy, play. Procedure: Steps: Open ➡️ Start ➡️ Program ➡️ Accessories ➡️ Notepad. Type the following training data set with the help of Notepad for weather table. a. relation weather a. attribute outlook {sunny, rainy, overcast} a. attribute temperature numeric a. attribute windly, {true, false} a. attribute play { yes, no} a. Data: sunny, 85.0, 85.0, false, no overcast, 80.0, 90.0, true, no sunny, 83.0, 86.0, false, yes rainy, 70.0, 80.0, false, yes overcast, 64.0, 65.0, false, yes sunny, 72.0, 95.0, true, no sunny, 69.0, 70.0, false, yes rainy, 75.0, 80.0, false, yes After that the file as saved with all file format. Minimize the file and than open start ➡️ program ➡️ WEKA -3-4. Click WEKA-3-4, then WEKA dialog box is displayed on the screen. In that dialog box there are four modes click on explorer. Explore shows many options In that click on open file and select the ARFF file. Click on edit button which shows weather table on WEKA. Experiment No.:3 Aim: Apply Pre-processing techniques to the training data set of Weather Table. Description: Real world databases are highly influenced to noise, missing, and inconsistency due to their queue size so the data can be pre-processed to improve the quality of data and missing results and it also improves the efficiency. There are 3 pre-processing techniques they are: Add Remove Normalization Creation of Weather Table : Procedure: Open ➡️ start ➡️ Program ➡️ Accessories ➡️ Notepad. Type the following training data set with the help of Notepad for weather table. a. relation weather a. attribute outlook {sunny, rainy, overcast} a. attribute temperature numeric a. attribute humidity numeric a. attribute windly {true, false} a. attribute play {yes, no} a. Data: sunny, 85.0, 85.0, false, no overcast, 80.0, 90.0, true, no sunny, 83.0, 86.0, false, yes rainy, 70.0, 86.0, false, yes rainy, 68.0, 80.0, false, yes overcast, 64.0, 65.0, true, no sunny, 69.0, 70.0, false, yes rainy, 75.0, 80.0, false, yes After that the file is saved with ARFF file format. Minimize the ARFF file and than open ➡️ Start ➡️ Program ➡️ WEKA-3-4. Click on WEKA-3-4 then WEKA dialog box is displayed on the screen. In that dialog box there are four modes click on explorer. Explorer shows many options In that click on open file and select the ARFF file. Click on edit button which shows weather table on WEKA. Add pre-processing technique. Procedure: Start ➡️ Programs ➡️ WEKA-3-4 Click on explores. Click on open file. Select weather ARFF file and click on open Click on choose button and select the filter option. In filter, we have supervised and unsupervised data. Click on unsupervised data. Select the attribute add. A new window is opened. In that we enter attribute index type data format nominal level value for climate Click on OK. Press the apply latter than a new attribute as added to the weather table. Save the file. Remove Pre-processing technique: Procedure : Start ➡️ Program ➡️ WEKA-3-4 ➡️ WEKA-3-4. Click on explorer. Click on open file. Select weather ARFF file and click on open. Click on choose button and select the printer option. In printer, we have have supervised data. Click on unsupervised data. Select the attribute remove. Select the attribute windly play and remove. Click remove button and then save. Click on the edit button it shows a new weather table on WEKA. Normalize Pre-processing Technique: Procedure : Start ➡️ Program ➡️ WEKA-3-4 ➡️ WEKA-3-4. Click on explore. Click on open file. Select weather ARFF file and click on open. Click choose button and select the printer option. In printer we have supervised and unsupervised data. Click on unsupervised data. Select the attribute normalized. Select the attribute temperature humidity to normalize. Click on the edit button, it shows a new weather table with normalized value on WEKA. Weather table after normalizing TEMPERATURE HUMIDITY. Experiment No.:4 Aim: Apply pre-processing techniques to the training data set of Employee Table Description: Real world databases are highly influenced to noise, missing and inconsistency due to their queue size so the data can be pre-processed to improve the quality of data and missing results and it also improves the efficiency. There are 3 pre-processing techniques they are : Add Remove Normalization Creation of Employee Table : Procedure : Open ➡️ Start ➡️ Programs ➡️ Accessories ➡️ Notepad . Type the following training data set truth the help of notepad for employee table. a. relation employee a. attribute name {x,y,z,a,b} a. attribute id numeric a. attribute salary {low, medium, high} a. attribute exp. numeric a. attribute gender {male, female} a. attribute phone numeric a. Data: x, 101, low, 2, male, 250311 y, 102, high, 3, female, 251665 z, 102, high, 5, female, 200200 a, 104, low, 1, male, 240328 b, 105, high, 2, male, 140240 3. After that the file is saved with ARFF file format. 4. Minimize the ARFF file and then open ➡️ Start ➡️ program ➡️ WEKA-3-4. 5. Click on WEKA-3-4 then WEKA dialog box is displayed on the screen. 6. In that dialog box there are four module click on explore. 7. Explorer shows many options In that click on open file and select the ARFF file. 8. Click on edit button which shows employee table on WEKA. WORK IN PROCESS ...

  • JavaScript Loops

    JavaScript For Loop Loops can execute a block of code a number of times. Loops are handy, if you want to run the same code over and over again, each time with a different value. Often this is the case when working with arrays: Example: JavaScript For Loop Output: JavaScript For Loop BMW Volvo Saab Ford Fiat Audi Different Kinds of Loops JavaScript supports different kinds of loops: for - loops through a block of code a number of times for/in - loops through the properties of an object for/of - loops through the values of an iterable object while - loops through a block of code while a specified condition is true do/while - also loops through a block of code while a specified condition is true JavaScript While Loop The While Loop The while loop loops through a block of code as long as a specified condition is true. Example: JavaScript While Loop Output: JavaScript While Loop The number is 0 The number is 1 The number is 2 The number is 3 The number is 4 The number is 5 The number is 6 The number is 7 The number is 8 The number is 9 Note : If you forget to increase the variable used in the condition, the loop will never end. This will crash your browser. The Do While Loop The do while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true. Example: JavaScript Do While Loop Output: JavaScript Do While Loop The number is 0 The number is 1 The number is 2 The number is 3 The number is 4 Note : Do not forget to increase the variable used in the condition, otherwise the loop will never end! JavaScript Break and Continue The Break Statement You have already seen the break statement used in an earlier chapter of this tutorial. It was used to "jump out" of a switch() statement. The break statement can also be used to jump out of a loop: Example: JavaScript Loops A loop with a break statement. Output: JavaScript Loops A loop with a break statement. The number is 0 The number is 1 The number is 2 The Continue Statement The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop. Example: JavaScript Loops A loop with a continue statement. A loop which will skip the step where i = 3. Output : JavaScript Loops A loop with a continue statement. A loop which will skip the step where i = 3. The number is 0 The number is 1 The number is 2 The number is 4 The number is 5 The number is 6

  • કોણ છે ગુજરાતના ટોપ-10 ધનિકો અને કોની થઈ એન્ટ્રી, હુરુન ઇન્ડિયાએ બહાર પાડ્યું લિસ્ટ

    - આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022માં ગુજરાતમાં 86 વ્યક્તિઓ સામેલ અમદાવાદ, 21 સપ્ટેમ્બર, 2022,બુધવાર હુરુન રિપોર્ટ ઇન્ડિયા અને આઇઆઇએફએલ વેલ્થએ 2022ની એડિશન ‘આઇઆઇએફએલ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022’ જાહેર કરી હતી – આ રૂ. 1000 કરોડ કે વધારે સંપત્તિ ધરાવતી સૌથ વધુ ધનિક વ્યક્તિઓની યાદીઓનું સંકલન છે. હુરુન રિપોર્ટ ઇન્ડિયા અને આઇઆઇએફએલ વેલ્થએ આજે આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022માં ગુજરાતમાંથી સૌથી વધુ ધનિક વ્યક્તિઓ અંગેનો વિસ્તૃત રિપોર્ટ રજૂ કર્યો છે. આઇઆઇએફએલ વેલ્થના સહ-સ્થાપક અને જોઇન્ટ CEO યતિન શાહે કહ્યું કે, “ગુજરાત ભારતમાં ઉદ્યોગસાહસિકતાનો વારસો ધરાવતા શ્રેષ્ઠ રાજ્યોમાં સામેલ છે અને ટેકનોલોજીની સ્વીકાર્યતા સાથે નાણાકીય જાગૃતિ હંમેશા ગુજરાતમાં વધારે રહી છે. રાજ્યના 86થી વધારે વ્યક્તિઓ ગુજરાતમાંથી આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022માં સામેલ થયા છે. ગુજરાતના સૌથી વધુ ધનિકો ફાર્મા ક્ષેત્રમાંથી છે અને ત્યારબાદ સૌથી વધુ ધનિકો કેમિકલ્સ એન્ડ પેટ્રોકેમિકલ્સ ક્ષેત્રના તથા જ્વેલરી ક્ષેત્રના છે.” આઇઆઇએફએલ વેલ્થ હુરુન ગુજરાત રિચ લિસ્ટમાં સામેલ એન્ટ્રન્ટ દસ વર્ષ અગાઉ 5થી ઓછા હતા, જે અત્યારે વધીને 86 થઈ ગયા છે. હકીકત એ છે કે, ગ્લોબલ ટોપ 10માં 2 અને ઇન્ડિયા ટોપ 10માં 4 ઉદ્યોગસાહસિકો ગુજરાતી મૂળના છે. લિસ્ટમાં સામેલ 1103 વ્યક્તિઓમાં 149 વ્યક્તિઓએ પ્રવેશ કર્યો છે. આ તમામની કુલ સંપત્તિ રૂ. 100 લાખ કરોડ છે.” ટોપ 10 વ્યક્તિઓ અગાઉના વર્ષની સરખામણીમાં વર્ષ 2022માં ટોપ 10 વ્યક્તિઓ માટે કટ-ઓફ રૂ. 1,800 કરોડ વધીને રૂ. 15,300 કરોડ થયું. રાજ્યના ટોપર ગૌતમ અદાણી એન્ડ ફેમિલીની સંપત્તિમાં એક વર્ષના ગાળામાં 116 ટકાનો વધારો થયો હતો. ટેબલ 1: આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022માં ગુજરાતમાં ટોપ 10 ધનકુબેરો - સ્તોત્રઃ આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022 ઉદ્યોગ-મુજબ બ્રેક-અપ રાજ્યના 21 ટકા સૌથી વધુ ધનિક વ્યક્તિઓ મુખ્યત્વે ફાર્માસ્યુટિકલ ઉદ્યોગમાં કાર્યરત છે. ગુજરાતના ધનિકોની યાદીમાં બીજો સૌથી વધુ પસંદગીનો ઉદ્યોગ કેમિકલ્સ એન્ડ પેટ્રોકેમિકલ્સ છે. ટેબલ 2: ટોપ 5 પ્રદાતા ઉદ્યોગો સ્તોત્રઃ આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022 નવો ઉમેરો ગુજરાતમાંથી કુલ 13 વ્યક્તિઓએ આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022માં પહેલી વાર પ્રવેશ કર્યો છે. આ 13 વ્યક્તિઓએ યાદીની કુલ સંપત્તિમાં રૂ. 28,700નો ઉમેરો કર્યો છે. ટેબલ 3: આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022માં ગુજરાતમાંથી સામેલ થયેલી ટોચની વ્યક્તિઓ સ્તોત્રઃ આઇઆઇએફએલ વેલ્થ હુરુન ઇન્ડિયા રિચ લિસ્ટ 2022 My Source: Gujarat Samachar ... .. .

  • 777 Charlie Movie (Dog's Lover)

    777 Charlie 777 Charlie is a 2022 Indian Kannada -language adventure comedy-drama film written and directed by Kiran raj K. and produced by Paramvah Studios . It stars Charlie, a labrador dog in the titular role, and Rakshit Shetty alongside Sangeetha Sringeri, Raj B. Shetty, Danish Sait and Bobby Simha . The film follows the journey and bonding between a lonely factory worker and a stray labrador dog. 777 Charlie was announced in September 2017. Principal photography took place from June 2018 to October 2021, with delays due to COVID-19 pandemic. The film was shot in various locations across Karnataka, Goa, Gujarat, Rajasthan, Punjab, Himachal Pradesh and Kashmir. 777 Charlie had a limited theatrical release on 2 June 2022, and released in cinemas worldwide on 10 June 2022. The film received huge critical acclaim for its cast performances (particularly Rakshit Shetty and Charlie), writing, emotional weight and direction. With theatrical earnings of ₹100 crore (US$13 million) globally, 777 Charlie became the fifth highest-grossing Kannada film at the time of release. Plot A Labrador puppy escapes from the house of a breeder where many dogs have been caged and tortured. The pup continues its journey and finally reaches the colony where Dharma resides. Dharma is a loner in a colony, who doesn't socialize with anyone and is feared and jealous among the colony people. His life consists of mainly working at the factory, fights, booze-smoke and watching Charlie Chaplin shows on TV. He is an orphan, whose parents and sister had died in a car crash caused by a dog and thereby leads a monotonous life. A musical fest at his colony makes the puppy scared and Dharma is enraged as his sleep is disturbed where he destroys the band instruments. The puppy views Dharma as her savior and secretly follows him. The Labrador takes shelter in the dustbin outside his house and consumes the leftover idli thrown by Dharma without his knowledge. It tries to gain attention of Dharma, but in vain. One day while leaving for the factory, the dog follows him and gets into a road accident. Feeling pity for the dog after watching Charlie Chaplin's bond with a dog, Dharma takes it to the hospital where he is advised by Dr. Ashwin Kumar to let the dog stay with him, till an adopter comes forward and advices to take dog license. Though reluctant as the colony members doesn't allow dogs, Dharma agrees and takes care of the dog where the bonding between him and the dog grows to an extent where Dharma becomes a better person and names the dog as Charlie after Charlie Chaplin and takes care of the dog with a child in the colony named Adrika aka Adi. One day, Charlie loses consciousness where Dharma learns that Charlie is suffering from cancer (Hemangiosarcoma of spleen) and this genetic defect have happened due to the breeder's unwanted breeding techniques and constant torture as Charlie is a female dog. Distraught, Dharma decides to fulfill Charlie's wishes where he learns that Charlie likes to play in snow as whenever snow appears in TV, she gets excited. He leaves with Charlie for Himachal Pradesh. En route, Dharma learns about Charlie's breeder and receives a video of Charlie's torture where he learns that Charlie's name was actually Keaton. Dharma confirms this by addressing Charlie as Keaton thereby Charlie responding to the name and shown to be in fear. He reaches the breeder's house and thrashes him and later caught by the police. The rest of the dogs gets rescued by the animal welfare team. Through a dog licence's expert Devika, Dharma meets Karshan Roy, who promises to publish his story in the magazine. Dharma and Charlie leave for Punjab where they meet a dog lover named Vamshi Singh and his dog Blacky, where Dharma and Charlie spent few days with Vamshi, Vamshi provides a dog competition pass to watch, but they become contestants where Charlie does a long jump, supported by Dharma and wins the competition. Without money and food, Dharma sells his bike and walks to continue their journey but Charlie's condition worsens. Dharma takes him to a monastery and learns that Charlie was pregnant with Blacky's child, but the puppies couldn't survive. The duo continue their journey in the bus but the bus is stopped by the army, and they reveal that a landslide occurred due to which the tourists are not allowed. After requests from Dharma, an officer agrees to take Charlie to Kashmir. The duo sneaks out and play in snow and return back to the camp. The following day, Charlie goes missing and Dharma leaves in search of Charlie. After a long search, he finds her at a temple waiting for him, who sits in his lap, then thanks him with her gesture and dies in Dharma's arms. Dharma is distraught but finds a puppy inside the temple and realises that Charlie gifted the puppy to him as she knows that Dharma cannot survive without her. A few months later, Dharma along with Devika, Adrika and the colony people inaugurate an animal rescue and shelter in the memory of Charlie. And Dharma sitting next to Charlie's memorial goes through the article published about the journey of Charlie and Dharma. Charlie's puppy also named as Charlie is shown to be more mischievous than its mother. ◻ Cast Charlie as Charlie /Keaton, a r Labrador Retrieve dog Rakshit Shetty as Dharma Sangeetha Sringeri as Devika Aradhya Raj B. Shetty as Dr. Ashwin Kumar Danish Sai as Karshan Roy Sharvari as Adhrika Bobby Simha as Vamsinadhan, a dog lover H. G. Soma Shekar Rao as tea stall owner Bhargavi Narayan as tea stall owner's wife Gopalakrishnan Desha pande as Kripakar, Dharma's colleague Dinesh Mangalore as SI Ranjan Shetty Abhijit Mahesh as compounder Anirudh Mahesh as Uttam, Dharma's colleague Vijay Vikram Singh as military officer Bengaluru Nagesh as Dharma's neighbor Salman Ahmed as Manju Harini as Dharma's mother Siddharth Bhatas Dharma's father Praanya P. Rao as Dharma's sister Dhanraj Sivakumar as Vicky Kiranraj K as North Indian hotel owner (cameo) Development In September 2017, Rakshit Shetty announced his next film under the production banner Paramvah Studios titled as 777 Charlie. Kiranraj K, who had assisted Rishabh Shetty in Ricky and Kirik Party, was brought on board for the project, which marked his directorial debut. Shetty agreed to produce the film as the script was considered to be "first-of-its-kind" in Kannada cinema.[9] Kiranraj also revealed that some sequences in the film were inspired from his real-life incidents. Before the film's production in June 2018, dog trainer BC Pramod trained three Labrador Retrievers to play the role of Charlie in the film for three weeks, as the bonding between the dog and the lead actor was to be real and convincing. Casting The makers initially considered Aravind Iyer as the lead actor, whom Shetty had recommended after working with him in Kirik Party. Shetty stated that "The character in the film works in a vehicle manufacturing factory and wears a rugged look, and even the neighborhood children are scared of him. The role perfectly suited Aravinnd and he came on board". But, as the production delayed, Iyer left the project in February 2018 as his schedule clashed with that of Bheemasena Nalamaharaja (2020). Subsequently, Shetty replaced him in the lead role. In May 2018, Pushkara Mallikarjunaiah announced a casting call for the film's female lead, in which Sangeetha Sringeriwas selected as the female lead from the audition with over 2,700 entries. Raj B. Shetty joined the cast in July 2018, where he played the role of a veterinary doctor. Danish Sait also joined the shoot in the first schedule. Child artists Sharvari and Praanya P Rao, also appeared a part of the film. In November 2020, it was announced that Tamil actor Bobby Simha would appear in a cameo role, marking his debut in the Kannada film industry. Filming The film's principal photography began in Mangalore on 8 June 2018, with Shetty joining the shoot after simultaneously working on the production of Avane Srimannarayana (2020). Kiranraj chose to shoot the first schedule in Mangalore as the opening sequences since "Charlie (the protagonist), who escapes from one place to another, finds himself in a fish market. As the scene needed an exclusive fish selling zone, which is not available anywhere in the state, which is why we chose Mangalore." The team shot a few sequences at Sakleshpur and then moved to Mysore and Bangalore, where Shetty joined the shooting schedule. In September 2018, it was revealed that portions with young Charlie had been completed, and the team needed to take a break, since Shetty planned to resume shooting for Avane Srimannarayana. The film has music by Nobin Paul, cinematography by Aravind Kashyap, and editing by Pratheek Shetty. In March 2018, the team resumed the shooting in Mysore with scenes featuring the protagonist in his old house as Mysore had old buildings, which suited the script. The team planned a 30-day schedule in the location and Shetty simultaneously worked on the film along with Avane Srimannarayana as he planned to release the two films within that year. Later, the team shot a few sequences in the Dandeli forest. Soon after the release of Avane Srimannarayana, Shetty rejoined the production team in late-January 2020 to shoot major sequences in North India. A montage song showcasing the bond between Charlie and Shetty was filmed in Goa. The makers also filmed a few portions in Goa, Gujarat, Rajasthan and Punjab. 777 Charlie completed 100 days of filming in March 2020, before the COVID-19 pandemic brought the production to a halt. Filming resumed in October 2020 after a six-month break with sequences being shot in Bangalore and Kodaikanal. Later, the team went on a location scouting in Himachal Pradesh and Kashmir to shoot more sequences, which began on 20 November 2020. Shetty joined the Kashmir schedule during the first week of December. However, due to the unpleasant weather, the team delayed the production, until filming resumed in January 2021. The film's schedule in Kashmir was completed on 27 January 2021. In June 2021, director Kiranraj stated that the team had filmed for a total of 160 days, with visuals for end credits pending to be shot. After 164 days of filming, including shooting for the patchwork scenes, the makers wrapped up the shoot on 25 October 2021. Post-production The post-production simultaneously began on 29 January 2021, when the team had completed 90% of the film's production. It was reported that Nobin Paul had started working on the film's background score during the COVID-19 pandemic lock down in August 2020. Rakshit Shetty began dubbing for the portions during March 2021, and the production team announced that 70% of the dubbing work had been completed. Since the film was to have a pan-India release, director Kiranraj and his team chose more than 200 voice artists to dub for the 50+ characters in five languages. He made sure that "the film never feels like a 'dubbed' film in other languages but instead the authenticity and local flavor is maintained in each version". After the completion of the filming, Kiranraj announced a December 2021 theatrical release. Music The score and soundtrack of 777 Charlie is composed and produced by Nobin Paul. Release Theatrical 777 Charlie had a limited theatrical release on 2 June 2022 with special preview screenings across 21 Indian cities starting with Delhi and Amritsar, and later moving to Jaipur, Mumbai, Kochi, Chennai, Pune on June 6 and Hyderabad, Ahmedabad, Nagpur, Solapur, Thiruvananthapuram, Varanasi, and Coimbatore on 7 June. The film was released worldwide in cinemas on 10 June 2022. Earlier in May 2021, director Kiranraj announced in an interview that 777 Charlie will have a theatrical release during the fourth quarter of that year. He said that "considering the budget, scale and the pan-Indian approach, one cannot assure the film being streamed in an over-the-top media service. The making of the film has been very taxing deal on us, sure, but the whole team wishes that the audience gets to see the film on the big screen. We have our hopes pinned on the vaccination drive and the government's approach in controlling the pandemic, thus the audience will be receptive to watching films in the theatres." The film will also be dubbed and released in Hindi, Telugu, Tamil, and Malayalam languages. The team planned to release the film on the last week of December, as the producers had a sentiment with Shetty's last two successful releases Kirik Party and Avane Srimman Narayana had released on the last week of December. In September 2021, the makers announced that 777 Charlie would be released theatrically on 31 December 2021, coinciding the New Year's Eve. A few weeks before the scheduled release, the producers announced that the premiere would be postponed. Apart from being considered for a dubbed version in Russian, it was reported to be one of the 39 movies considered by China to dub in their language. Distribution In June 2021, Prithviraj Sukumaran who watched few scenes from the preview of this film, had agreed to acquire the rights under the Prithviraj Productions banner for the film's Malayalam-dubbed version. The same month, Karthik Subbaraj's Stone Bench Films acquired the distribution rights for the Tamil-dubbed version. Home media The film was digitally streamed on Voot Select on 29 July 2022. Reception Critical reception Grace Cyril of India Today rated the film 4 out of 5 stars and wrote "777 Charlie is filled with emotional, fun and aww-worthy moments". Tini Sara Anien of Deccan Herald rated the film 4 out of 5 stars and wrote "777 Charlie' is a family film with a difference and let's hope the film inspires a healthy trend in Kannada cinema". A critic for Sakshi Post rated the film 4 out of 5 stars and wrote "Rakshit Shetty's Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadha of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express rated the film 3.5 out of 5 stars and wrote " ‘777 Charlie’ is a treat for fans of both Rakshit Shetty and films that convey essential messages, such as pet adoption in this case. There is a lot of heart and soul in the movie, with moments that will leave you with teary eyes at the end". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadha of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express The Times of India rated the film 3.5 out of 5 stars and wrote " ‘777 Charlie’ is a treat for fans of both Rakshit Shetty and films that convey essential messages, such as pet adoption in this case. There is a lot of heart and soul in the movie, with moments that will leave you with teary eyes at the end". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadhaa of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express Archika Khurana of The Times of India rated the film 3.5 out of 5 stars and wrote " ‘777 Charlie’ is a treat for fans of both Rakshit Shetty and films that convey essential messages, such as pet adoption in this case. There is a lot of heart and soul in the movie, with moments that will leave you with teary eyes at the end". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadhaa of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express Archika Khurana of The Times of India rated the film 3.5 out of 5 stars and wrote " ‘777 Charlie’ is a treat for fans of both Rakshit Shetty and films that convey essential messages, such as pet adoption in this case. There is a lot of heart and soul in the movie, with moments that will leave you with teary eyes at the end". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadhaa of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll .in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express777 Charlie is an emotional rollercoaster ride". Archika Khurana of The Times of India rated the film 3.5 out of 5 stars and wrote " ‘777 Charlie’ is a treat for fans of both Rakshit Shetty and films that convey essential messages, such as pet adoption in this case. There is a lot of heart and soul in the movie, with moments that will leave you with teary eyes at the end". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadhaa of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll .in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". rated the film 3 out of 5 stars and wrote "Amid larger-than-z life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling".[Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadhaa of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll .in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadha of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Kiranraj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry".[ Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadha of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Ki ran raj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadha of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Ki ran raj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there". Manoj Kumar R of The Indian Express rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". Archika Khurana of The Times of India rated the film 3.5 out of 5 stars and wrote " ‘777 Charlie’ is a treat for fans of both Rakshit Shetty and films that convey essential messages, such as pet adoption in this case. There is a lot of heart and soul in the movie, with moments that will leave you with teary eyes at the end". Shubham Kulkarni of Koimoi rated the film 3.5 out of 5 stars and wrote "777 Charlie is a film made for you to suspend your disbelief and watch with all your hearts laugh, cry". Latha Srinivasan of First post rated the film 3.5 stars out of 5 stars and wrote "Kiranraj K's 777 Charlie makes you feel emotions you haven't felt in a while and honestly it's a good feeling". Soundarya Athimuthu of The Quint wrote "Even if you are not a pet lover, 777 Charlie will turn you into one". A Sharadha of The New Indian Express rated the film 3.5 out of 5 stars and wrote "777 Charlie is definitely an ode to dog lovers and Ki ran raj, Rakshit and Co have crafted it in such a way that even if you are not one, watching this film just might make you revisit that stance". Nandini Ramnath of Scroll. in rated wrote "Dharma's road trip with Charlie seemingly has a destination, but the film takes forever to get there" Manoj Kumar R of The Indian Express rated the film 3 out of 5 stars and wrote "Amid larger-than-life, violence-prone cinema we have watched this year, this Rakshit Shetty-starrer offers a quieter experience of self-reflection about the absurdity of life". Legacy The demand for Labradors was reported to have increased after the release of the film. However, experts and activists were of the view that pets should not be brought home on the basis of short term plan based on temporary flow of emotions since it would lead to sudden spike in their demand leading to unethical breeding which ironically was spoken against in the movie. A sniffer dog inducted into the Mangalore police department was named Charlie. (Source: Wikipedia) Thanks For Read My Blog

  • Dynamic HTML with CSS & XML BCA Sem-III

    Bachelor Computer Application Subject Name: Dynamic HTML with CSS & XML Subject Code: 1040233201 BCA SEMESTER - III Prerequisite: Basic Knowledge of HTML technology Objective: The course will create basic fundamental of design dynamic html pages using JavaScript and CSS. Teaching and Examination Scheme: Content: Course Outcome: Teaching & Learning Methodology:- • The course includes a laboratory, where students have an opportunity to build an appreciation for the concepts being taught in lectures. • Lectures with live practical example using Projector and Computer • Experiments shall be performed in the laboratory related to course contents. List of Experiments/Tutorials: Major Equipment: 1. Computer System 2. Projector Books Recommended:- 1. HTML 5 in Simple Steps Publisher: Dream Tech Press By Kongent solution 2. JavaScript 2nd Edition Step by step Publisher :Microsoft corporation By Steve suehring. 3. XML and Related Technologies Publisher: Pearson Education By Atul Kahate List of Open Source Software/learning website: 1. https://www.coursera.org/courses?query=c%20programming 2. https://www.udemy.com/ 3. https://www.tutorialspoint.com/cprogramming 4. NPTEL Tutorials .

  • Computer Networks BCA Sem-III

    Bachelor of Computer Application Subject Name: Computer Networks Subject Code: 1040233203 Semester - III Prerequisite: Basic information of Computer hardware and Devices Objective: The course will create basic fundamental of Networking and network devices with functions. Introduce to data transfer in Network. Teaching and Examination Scheme: Content: Course Outcome: Teaching & Learning Methodology:- • The course includes a laboratory, where students have an opportunity to build anappreciation for the concepts being taught in lectures. • Lectures with live practical example using Projector and Computer • Experiments shall be performed in the laboratory related to course contents. List of Experiments/Tutorials: Major Equipment: 1. Computer System 2. Switches and HUB 3. LAN cable, Crimping Tools Books Recommended:- 1. Computer Networking- A Top-Down approach, 5th edition, Kurose and Ross, Pearson 2. Computer Networks (4th edition), Andrew Tanenbaum, Prentice Hall List of Open Source Software/learning website: 3. https://www.coursera.org/courses?query=c%20programming 4. https://www.udemy.com/ 5. https://www.tutorialspoint.com/cprogramming 6. NPTEL Tutorials

  • Carry Minati's Career

    Name: Ajey Nagar Born: 12 June 1999 Faridabad, Haryana, India. Occupation: Youtuber Also known as : Carry, Ajey, CarryMinati Location: Faridabad, Haryana, India. YouTube: @CarryMinati Instagram: @carryminati Career : Ajey Nagar is based in Faridabad, a city near India's national capital New Delhi. Popularly referred to as CarryMinati,[5] Nagar is mainly involved in creating Hindi language roasting and comedy videos, diss songs, satirical parodies, apart from live gaming.[1][6] Nagar and his team produce videos out of his home in Faridabad. Nagar began posting videos on YouTube at the age of 10. His main YouTube channel has been active since 2014. In 2014, the channel's name was AddictedA1 and Nagar would upload recorded video game footage along with his reactions to the game. In 2015, he changed the channel's name to CarryDeol, uploading gameplay footage of Counter-Strike: Global Offensive while mimicking Sunny Deol. The channel was subsequently renamed to CarryMinati. In May 2021, Nagar released a statement saying that the channel had more than 30 million subscribers. In early 2017, Nagar created an additional YouTube channel called CarryIsLive, where he live-streams himself playing video games. He has hosted live-streams on this channel, raising funds for victims of cyclone Fani in Odisha in 2019, and the flooding in Assam and Bihar in 2020. In 2019, Nagar was listed at the 10th position in the Next Generation Leaders' 2019 by Time magazine, which is an annual list of ten young people who construct innovative careers. In April 2020 he was part of Forbes 30 Under 30Asia. He had a cameo appearance as himself in the 2022 movie Runway 34. "YouTube vs TikTok–The End" In May 2020, Nagar published a controversial YouTube video titled "YouTube Vs TikTok–The End", in response to a video shared on Instagram by TikTok user Amir Siddiqui who berated YouTube creators for roasting TikTok users. It was taken down by YouTube citing violations of its terms of service, based on multiple complaints of harassment and cyberbullying. A large number reports had been made by LGBTQ+ activists, on account of homophobic or transphobic abusive language in the video. Many of Nagar's fans were critical of YouTube's actions, and the removal led to several new trending hashtags mentioning his name. As a result, the video received several million views, and there was a concerted effort to review bomb TikTok at Google Play Store. Other fans of Nagar spoke out in favor of YouTube's decision to remove the video.[3][16] In June 2020, Nagar uploaded the music video "Yalgaar" as a further response, with renewed criticism of Siddiqui.

  • Database Management System IMP Que. (BCA sem-ii)

    Bachelor Computer Application (BCA) Database Management System (DBMS) Most Important Question Banks Unit-1 Database System Architecture Q-1 Give Function of DBMS. Application of DBMS. Ans: The DBMS performs several important functions that guarantee the integrity and consistency of data in the database. The current generation DBMS supports many functions, such as the following:  Stores the definitions of data and their relationships (metadata) in a data dictionary, any changes made are automatically recorded in the data dictionary.  Creates the complex structures required for data storage.  Transforms entered data to conform to the data structures.  Creates a security system and enforces security within that system.  Allow multiple user access to the data within the computer network environment.  Performs backup and data recovery procedures to ensure data safety.  Promotes and enforces integrity rules to maintain data consistency.  Provides access to the data via utility programs and from programming languages interfaces. Application of DBMS: Database is widely used all around the world in different sectors. Various applications of DBMS in these sectors are given below:  Airlines: For reservation and schedule information. Airlines were among the first to use database in a geographically disturbed manner-terminals situated around the world accessed the central database system through phone lines and other data networks.  Telecommunications: For keeping records of calls made, generating monthly bills, maintaining balances on prepaid calling cards and storing information about the communication networks.  Universities: For student information, Course registrations and grades.  Sales: For customer, product and purchase information.  Banking: For customer information. Accounts , loans and banking transactions.  Human Resources: For information about employees, salaries, payroll taxes and benefits and for generation of paychecks. Q-2 What are the Advantages of DBMS over file System.? Ans: Advantages of DBMS: A DBMS manages data and has many benefits. These are:  Data Redundancy can be reduced: In Non-database systems, each application or department has its own private files resulting in considerable amount of redundancy of the stored data. Thus storage space is wasted. By having a centralized database most of this can be avoided.  Data Inconsistency: Data inconsistency can be avoided. When the same data is duplicated and changes are made at one side, which is not propagated to the other site, it gives rise to inconsistency. Then the two entries regarding the same data will not agree. So, if the redundancy is removed , Chance of having inconsistent data is also removed.  Data independence: Application programs should be as free or independent as possible from details of data representation and storage. DBMS can supply an abstract view of the data for insulating application code from such facts.  Efficient data access: DBMS utilizes a mixture of sophisticated concepts and techniques for storing and retrieving data competently. This feature becomes important in cases where the data is stored on external storage devices.  Data integrity and security: If data is accessed through the DBMS, the DBMS can enforce integrity constraints on the data.  Data administration: When several users share the data, integrating the administration of data can offer significant improvements. Experienced professionals understand the nature of the data being managed and can be responsible for organizing the data representation to reduce redundancy and make the data to retrieve efficiently. Q-3 Explain levels / view of data / Data Abstraction in dbms with appropriate example. Ans: A major purpose of a database system is to provide users with an abstract view of the data. That is, the system hides certain details of how the data are stored and maintained. This is called data abstraction. There are three levels of data abstraction: I. Physical Level: It is the lowest level of abstraction that describes how the data are actually stored. The physical level describes complex low level data structures in detail. II. Logical Level: it is the next higher level of abstraction that describes what data are stored in the database and what relationships exist among these data. III. View Level: It is the highest level of abstraction that describes only part of the entire database. Shows the relationships among the three. For Example, Consider a banking example with records.:  Account, with fields accno, balance  Employee, with fields employeename and salary  Customer, with fields customername and customerid, address. At the physical level, a customer, account, or employee record can be described as a block of consecutives storage locations(for example, words or bytes). The language compiler hides this level of deatail from programmers. Q-4 Explain Data Security and Integrity. Ans. 1.Data Security : Data security refers to the prevention of data from unauthorized users. It is only allowed to access the data to the authorized users. In database, the DBA or head of department can access all the data. Some users are only allowed to retrieve data, whereas others are allowed to retrieve as well as to modify the data. 2.Data Integrity : Data integrity is defined as the data contained in the database is both correct and consistent. For this purpose, the data stored in the database must satisfy certain types of procedures (rules). The data in a database must be correct and consistent. DBMS provides different ways to implement such types of constraints (rules). It can be implemented by rules i.e., Primary Key, Secondary Key, Foreign key. This improves data integrity in a database. Q-5 Explain Types of database system architecture with diagram in detail. Ans. Database architecture can be seen as a single tier or multi-tier. But logically, database architecture is of two types like: 2-tier architecture and 3-tier architecture. 1-Tier Architecture: o In this architecture, the database is directly available to the user. It means the user can directly sit on the DBMS and uses it. o Any changes done here will directly be done on the database itself. It doesn't provide a handy tool for end users. o The 1-Tier architecture is used for development of the local application, where programmers can directly communicate with the database for the quick response. 2-Tier Architecture: o The 2-Tier architecture is same as basic client-server. In the two-tier architecture, applications on the client end can directly communicate with the database at the server side. For this interaction, API's like: ODBC, JDBC are used. o The user interfaces and application programs are run on the client-side. o The server side is responsible to provide the functionalities like: query processing and transaction management. o To communicate with the DBMS, client-side application establishes a connection with the server side. Fig: 2-tier Architecture 3-Tier Architecture: o The 3-Tier architecture contains another layer between the client and server. In this architecture, client can't directly communicate with the server. o The application on the client-end interacts with an application server which further communicates with the database system. o End user has no idea about the existence of the database beyond the application server. The database also has no idea about any other user beyond the application. o The 3-Tier architecture is used in case of large web application. Unit-2 Data Models Q-6 Explain the network Model. Give advantages and disadvantages of it. Ans: The network model was created to represent complex data relationships more effectively when compared to hierarchical models, to improve database performance and standards. It has entities which are organized in a graphical representation and some entities are accessed through several paths. A User perceives the network model as a collection of records in 1:M relationships. Advantages: The advantages of network model are as follows:  Network models represent complex data relationships better than the hierarchical models.  It handles so many relationship types.  Data access is more flexible than hierarchical models.  Improved database performance.  It includes Data Definition Language (DDL) and Data Manipulation Language (DML) commands. Disadvantages: The disadvantages of network model are as follows:  Database contains a complex array of pointers.  System complexity limits efficiency.  Structural changes require changes in all application programs.  Navigation systems yield complex implementation and management.  Keep heavy pressure on programmers due to the complex structure.  Any change like updating, deletion, insertion is very complex. Q-7 Explain basic concepts of referential integrity. Ans. Referential integrity refers to the relationship between tables. Because each table in a database must have a primary key, this primary key can appear in other tables because of its relationship to data within those tables. When a primary key from one table appears in another table, it is called a foreign key. Foreign keys join tables and establish dependencies between tables. tables can form a hierarchy of dependencies in such a way that if you change or delete a row in one table, you destroy the meaning of rows in other tables. For example, the following figure shows that the customer_num column of the customer table is a primary key for that table and a foreign key in the orders and cust_call tables. Customer number 106, George Watson™, is referenced in both the orders and cust_calls tables. If customer 106 is deleted from the customer table, the link between the three tables and this particular customer is destroyed. Figure 1. Referential integrity in the demonstration database When you delete a row that contains a primary key or update it with a different primary key, you destroy the meaning of any rows that contain that value as a foreign key. Referential integrity is the logical dependency of a foreign key on a primary key. The integrity of a row that contains a foreign key depends on the integrity of the row that it references—the row that contains the matching primary key. By default, the database server does not allow you to violate referential integrity and gives you an error message if you attempt to delete rows from the parent table before you delete rows from the child table. You can, however, use the ON DELETE CASCADE option to cause deletes from a parent table to trip deletes on child tables. See To define primary and foreign keys, and the relationship between them, use the CREATE TABLE and ALTER TABLE statements. For more information on these statements, see the IBM® Informix® Guide to SQL: Syntax. For information about how to build a data model with primary and foreign keys, see the IBM Informix Database Design and Implementation Guide. Q-8 Construct E –R diagram of the bank. It provides different kinds of bank accounts and loan. it operates number of branches . Ans. Unit-3 Relational Query Languages Que 9: Explain Selection and Projection relational algebra in detail. Ans: 1. Selection : This operation chooses the subset of tuples from the relation that satisfies the given condition mentioned in the syntax of selection. Notation – σ p (R) Here, ‘p’ is selection condition and ‘σ (sigma)’ is used to denote Select Operator. Example: σ Branch=”BCA” (Student) 2. Projection : This operation selects certain required attributes, while discarding other attributes. Notation – πA (R) where ‘A’ is the attribute list, it is the desired set of attributes from the attributes of relation(R), symbol ‘π(pi)’ is used to denote the project operator, R is generally a relational algebra expression, which results in a relation. Example: π Branch (Student) Unit-4 Relational Database Design Que 10: What is normalization? List out types of normalization. Explain the advantages and disadvantages of normalization. Ans: Normalization:  Normalization is the  Normalization is used minimize the redundancy from a relation or set of relations. It is also used to eliminate undesirable characteristics like Insertion, Update, and Deletion Anomalies. Types of Normalization:  1NF (First Normal  2NF (Second Normal  3NF (Third Normal Form)  BCNF (Boyce-Codd Normal Form)  4NF (Fourth Normal Form)  5NF (Fifth Normal Form)  6NF (Sixth Normal Form) Advantages of Normalization:  Normalization helps to minimize data redundancy  Greater overall database organization  Data consistency within the database  Much more flexible database design.  Enforces the concept of relational integrity Disadvantages of Normalization:  You cannot start building the database before knowing what the user needs.  The performance degrades when normalizing the relations to higher normal forms , i.e., 4NF, 5NF.  It is very time-consuming and difficult to normalize relations of a higher degree.  Careless decomposition may lead to a bad database design, leading to serious problems. Que 11: Explain 1 NF and 2 NF in detail with example. Ans: First Normal Form (1NF):  For a table to be in the First  Below table is not in 1 NF because the subject column contain multiple values for single roll_no. So, 2nd table is in 1 NF. Second Normal Form (2NF)  For a table to be in the Second Normal Form  It should be in the First Normal Form  And, it should not have Partial Dependency  Here 1st table is not in 2 NF because it contains partial dependency and 2nd table is in 2 NF. Unit- 5 Query Processing and Optimization Que 12: Explain steps of query Processing in detail. Ans: Query Processing is a translation of high-level queries into low-evel expression.  given SQL query is translated by the query processor into a low level program called an execution plan  An execution plan is a program in a functional language  The physical relational algebra with primitives to search through the internal storage structure of DBMS. Basic Steps in Query Processing: 1. Parsing and translation 2. Optimization 3. Evaluation 1. Parsing and translation:  Translate the query its internal form. This is then transleted into relational Algebra.  Parser checks syntax, verifies relation. 2. Optimization:  SQL is a very high level language.  The users specify what to search for not how the search is actually done  The algorithms are chosen automatically by the DBMS.  For a given SQL query there may be many possible execution plans.  Amongst all equivalent plans choose the one with lowest cost.  Cost is estimated using statistical information from the database catalog. 3. Evaluation:  The query evaluation engine takes a query evalution plan, executes that plan and returns the answer to that query. Que 13: Explain the conditions for 1 NF, 2 NF, 3 NF, 4 NF, 5 NF and BCNF. Ans: Unit-6 Storage Strategies Que-14: Explain the structure of Index in database. Explain different attributes of Indexing. Ans: Indexing is used to optimize the performance of a database by minimizing the number of disk accesses required when a query is processed. The index is a type of data structure. It is used to locate and access the data in database table quickly. Indexes are created using a few database columns.  The first column of the database is the search key that contains a copy of the primary key or candidate key of the table. The values of the primary key are stored in sorted order so that the corresponding data can be accessed easily.  The second column of the database is the data reference. It contains a set of pointers holding the address of the disk block where the value of the particular key can be found. The indexing has various attributes: Access Types: This refers to the type of access such as value based search, range access, etc. Access Time: It refers to the time needed to find particular data element or set of elements. Insertion Time: It refers to the time taken to find the appropriate space and insert a new data. Deletion Time: Time taken to find an item and delete it as well as update the index structure. Space Overhead: It refers to the additional space required by the index. Que-15: What is Hashing? Explain dynamic hashing. Ans-:  In this technique, data is stored at the data blocks whose address is generated by using the hashing function. The memory location where these records are stored is known as data bucket or data blocks.  In this, a hash function can choose any of the column value to generate the address. Most of the time, the hash function uses the primary key to generate the address of the data block. A hash function is a simple mathematical function to any complex mathematical function. We can even consider the primary key itself as the address of the data block. That means each row whose address will be the same as a primary key stored in the data block. There are two types of hashing: Dynamic hashing:-  The dynamic hashing method is used to overcome the problems of static hashing like bucket overflow.  In this method, data buckets grow or shrink as the records increases or decreases. This method is also known as extendable hashing method.  This method makes hashing dynamic, i.e., it allows insertion or deletion without resulting in poor performance. How to search a key:  First, calculate the hash address of the key.  Check how many bits are used in the directory, and these bits are called as i.  Take the least significant i bits of the hash address. This gives an index of the directory.  Now using the index, go to the directory and find bucket address where the record might be. How to insert a new record :  Firstly, you have to follow the same procedure for retrieval, ending up in some bucket.  If there is still space in that bucket, then place the record in it.  If the bucket is full, then we will split the bucket and redistribute the records. E.X.:-  Consider the following grouping of keys into buckets, depending on the prefix of their hash address: The last two bits of 2 and 4 are 00. So it will go into bucket B0. The last two bits of 5 and 6 are 01, so it will go into bucket B1. The last two bits of 1 and 3 are 10, so it will go into bucket B2. The last two bits of 7 are 11, so it will go into B3. Advantages of dynamic hashing :  In this method, the performance does not decrease as the data grows in the system. It simply increases the size of memory to accommodate the data.  In this method, memory is well utilized as it grows and shrinks with the data. There will not be any unused memory lying.  This method is good for the dynamic database where data grows and shrinks frequently. Unit- 7 Transaction Processing Que-16:- what is transaction? Explain properties of transaction. Ans-: A transaction is a sequence of operations performed as a single logical unit of work. A transaction is a logical unit of work that contains one or more SQL statements. Example of transaction:- Want to transfer Rs. 50 from Account-A to Account-B The transaction has the four properties. These are used to maintain consistency in a database, before and after the transaction. Property of Transaction: 1. Atomicity 2. Consistency 3. Isolation 4. Durability (i) Atomicity : o It states that all operations of the transaction take place at once if not, the transaction is aborted. o There is no midway, i.e., the transaction cannot occur partially. Each transaction is treated as one unit and either run to completion or is not executed at all. Atomicity involves the following two operations: Abort: If a transaction aborts then all the changes made are not visible. Commit: If a transaction commits then all the changes made are visible. Example: Let's assume that following transaction T consisting of T1 and T2. A consists of Rs 600 and B consists of Rs 300. Transfer Rs 100 from account A to account B. After completion of the transaction, A consists of Rs 500 and B consists of Rs 400. If the transaction T fails after the completion of transaction T1 but before completion of transaction T2, then the amount will be deducted from A but not added to B. This shows the inconsistent database state. In order to ensure correctness of database state, the transaction must be executed in entirety. Consistency : o The integrity constraints are maintained so that the database is consistent before and after the transaction. o The execution of a transaction will leave a database in either its prior stable state or a new stable state. o The consistent property of database states that every transaction sees a consistent database instance. o The transaction is used to transform the database from one consistent state to another consistent state. For example: The total amount must be maintained before or after the transaction. 1. Total before T occurs = 600+300=900 2. Total after T occurs= 500+400=900 Therefore, the database is consistent. In the case when T1 is completed but T2 fails, then inconsistency will occur. Isolation: o It shows that the data which is used at the time of execution of a transaction cannot be used by the second transaction until the first one is completed. o In isolation, if the transaction T1 is being executed and using the data item X, then that data item can't be accessed by any other transaction T2 until the transaction T1 ends. o The concurrency control subsystem of the DBMS enforced the isolation property. Durability: o The durability property is used to indicate the performance of the database's consistent state. It states that the transaction made the permanent changes. o They cannot be lost by the erroneous operation of a faulty transaction or by the system failure. When a transaction is completed, then the database reaches a state known as the consistent state. That consistent state cannot be lost, even in the event of a system's failure. o The recovery subsystem of the DBMS has the responsibility of Durability property. Que-17:- Explain Log-Based Recovery Ans:- o The log is a sequence of records. Log of each transaction is maintained in some stable storage so that if any failure occurs, then it can be recovered from there. o If any operation is performed on the database, then it will be recorded in the log. o But the process of storing the logs should be done before the actual transaction is applied in the database. Let's assume there is a transaction to modify the City of a student. The following logs are written for this transaction.  When the transaction is initiated, then it writes 'start' log.   When the transaction modifies the City from 'Noida' to 'Bangalore', then another log is written to the file.   When the transaction is finished, then it writes another log to indicate the end of the transaction.  There are two approaches to modify the database: 1. Deferred database modification: o The deferred modification technique occurs if the transaction does not modify the database until it has committed. o In this method, all the logs are created and stored in the stable storage, and the database is updated when a transaction commits. 2. Immediate database modification: o The Immediate modification technique occurs if database modification occurs while the transaction is still active. o In this technique, the database is modified immediately after every operation. It follows an actual database modification. Recovery using Log records When the system is crashed, then the system consults the log to find which transactions need to be undone and which need to be redone. 1. If the log contains the record and or , then the Transaction Ti needs to be redone. 2. If log contains record but does not contain the record either or , then the Transaction Ti needs to be undone. Que-18: Explain Deadlock with suitable example. Ans-: A deadlock is a condition where two or more transactions are waiting indefinitely for one another to give up locks. Deadlock is said to be one of the most feared complications in DBMS as no task ever gets finished and is in waiting state forever. For example: In the student table, transaction T1 holds a lock on some rows and needs to update some rows in the grade table. Simultaneously, transaction T2 holds locks on some rows in the grade table and needs to update the rows in the Student table held by Transaction T1. Now, the main problem arises. Now Transaction T1 is waiting for T2 to release its lock and similarly, transaction T2 is waiting for T1 to release its lock. All activities come to a halt state and remain at a standstill. It will remain in a standstill until the DBMS detects the deadlock and aborts one of the transactions. E.X.-2: Unit- 8 Database Security Q-19 . How Many types of Access control. DAC And MAC in details. Ans :Obsolete access models include Discretionary Access Control (DAC) and Mandatory Access Control (MAC). Role Based Access Control (RBAC) is the most common method today, and the most recent model is Attribute Based Access Control (ABAC). Discretionary Access Control (DAC) With DAC models, the data owner allows access. DAC is a means of assigning access rights based on user-specified rules. Mandatory Access Control (MAC) MAC was developed using a nondiscretionary model, in which people are granted access based on an information clearance. MAC is a policy in which access rights are assigned based on central authority regulations. Role Based Access Control (RBAC) RBAC grants access based on a user’s role and implements key security principles such as “least privilege” and “separation of privilege.” Thus, someone attempting to access information can only access data necessary for their role. Attribute Based Access Control (ABAC) In ABAC, each resource and user are assigned a series of attributes. In this dynamic method, a comparative assessment of the user’s attributes, including time of day, position and location, are used to make a decision on access to a resource. 1.DAC : DAC is identity-based access control. DAC mechanisms will be controlled by user identification such as username and password. DAC is discretionary because the owners can transfer objects or any authenticated information to other users. In simple words, the owner can determine the access privileges. Attributes of DAC – 1. Users can transfer their object ownership to another user. 2. The access type of other users can be determined by the user. 3. Authorization failure can restrict the user access after several failed attempts. 4. Unauthorized users will be blind to object characteristics called file size, directory path, and file name. Examples- Permitting the Linux file operating system is an example of DAC. 2.MAC : The operating system in MAC will provide access to the user based on their identities and data. For gaining access, the user has to submit their personal information. It is very secure because the rules and restrictions are imposed by the admin and will be strictly followed. MAC settings and policy management will be established in a secure network and are limited to system administrators. Attributes of MAC – 1. MAC policies can help to reduce system errors. 2. It has tighter security because only the administrator can access or alter controls. 3. MAC has an enforced operating system that can label and delineate incoming application data. 4. Maintenance will be difficult because only the administrator can have access to the database. Examples- Access level of windows for ordinary users, admins, and guests are some of the examples of MAC. Q-20 Different between DAC and MAC. Ans-: Q-21 What is the IDS(Intrusion Detection System)? Explain Classification of IDS. Ans-: An Intrusion Detection System (IDS) is a system that monitors network traffic for suspicious activity and issues alerts when such activity is discovered. It is a software application that scans a network or a system for the harmful activity or policy breaching. Any malicious venture or violation is normally reported either to an administrator or collected centrally using a security information and event management (SIEM) system. A SIEM system integrates outputs from multiple sources and uses alarm filtering techniques to differentiate malicious activity from false alarms. Although intrusion detection systems monitor networks for potentially malicious activity, they are also disposed to false alarms. Hence, organizations need to fine-tune their IDS products when they first install them. It means properly setting up the intrusion detection systems to recognize what normal traffic on the network looks like as compared to malicious activity. Intrusion prevention systems also monitor network packets inbound the system to check the malicious activities involved in it and at once send the warning notifications. Classification of Intrusion Detection System: IDS are classified into 5 types: 1. Network Intrusion Detection System (NIDS): Network intrusion detection systems (NIDS) are set up at a planned point within the network to examine traffic from all devices on the network. It performs an observation of passing traffic on the entire subnet and matches the traffic that is passed on the subnets to the collection of known attacks. Once an attack is identified or abnormal behavior is observed, the alert can be sent to the administrator. An example of a NIDS is installing it on the subnet where firewalls are located in order to see if someone is trying to crack the firewall. 2. Host Intrusion Detection System (HIDS): Host intrusion detection systems (HIDS) run on independent hosts or devices on the network. A HIDS monitors the incoming and outgoing packets from the device only and will alert the administrator if suspicious or malicious activity is detected. It takes a snapshot of existing system files and compares it with the previous snapshot. If the analytical system files were edited or deleted, an alert is sent to the administrator to investigate. An example of HIDS usage can be seen on mission-critical machines, which are not expected to change their layout. 3. Protocol-based Intrusion Detection System (PIDS): Protocol-based intrusion detection system (PIDS) comprises a system or agent that would consistently resides at the front end of a server, controlling and interpreting the protocol between a user/device and the server. It is trying to secure the web server by regularly monitoring the HTTPS protocol stream and accept the related HTTP protocol. As HTTPS is un-encrypted and before instantly entering its web presentation layer then this system would need to reside in this interface, between to use the HTTPS. 4. Application Protocol-based Intrusion Detection System (APIDS): Application Protocol-based Intrusion Detection System (APIDS) is a system or agent that generally resides within a group of servers. It identifies the intrusions by monitoring and interpreting the communication on application-specific protocols. For example, this would monitor the SQL protocol explicit to the middleware as it transacts with the database in the web server. 5. Hybrid Intrusion Detection System : Hybrid intrusion detection system is made by the combination of two or more approaches of the intrusion detection system. In the hybrid intrusion detection system, host agent or system data is combined with network information to develop a complete view of the network system. Hybrid intrusion detection system is more effective in comparison to the other intrusion detection system. Prelude is an example of Hybrid IDS. Q-22 Explain SQL Injection with example and types of SQL Injection attacks. Ans-: The SQL Injection is a code penetration technique that might cause loss to our database. It is one of the most practiced web hacking techniques to place malicious code in SQL statements, via webpage input. SQL injection can be used to manipulate the application's web server by malicious users. SQL injection generally occurs when we ask a user to input their username/userID. Instead of a name or ID, the user gives us an SQL statement that we will unknowingly run on our database. For Example - we create a SELECT statement by adding a variable "demoUserID" to select a string. The variable will be fetched from user input (getRequestString). 1. demoUserI = getrequestString("UserId"); 2. demoSQL = "SELECT * FROM users WHERE UserId =" +demoUserId; Types of SQL injection attacks SQL injections can do more harm other than passing the login algorithms. Some of the SQL injection attacks include: o Updating, deleting, and inserting the data: An attack can modify the cookies to poison a web application's database query. o It is executing commands on the server that can download and install malicious programs such as Trojans. o We are exporting valuable data such as credit card details, email, and passwords to the attacker's remote server. o Getting user login details: It is the simplest form of SQL injection. Web application typically accepts user input through a form, and the front end passes the user input to the back end database for processing. Example of SQL Injection We have an application based on employee records. Any employee can view only their own records by entering a unique and private employee ID. We have a field like an Employee ID. And the employee enters the following in the input field: 236893238 or 1=1 It will translate to: 1. SELECT * from EMPLOYEE where EMPLOYEE_ID == 236893238 or 1=1 The SQL code above is valid and will return EMPLOYEE_ID row from the EMPLOYEE table. The 1=1 will return all records for which this holds true. All the employee data is compromised; now, the malicious user can also similarly delete the employee records. Example: 1. SELECT * from Employee where (Username == "" or 1=1) AND (Password="" or 1=1). Now the malicious user can use the '=' operator sensibly to retrieve private and secure user information. So instead of the query mentioned above, the following query, when exhausted, retrieve protected data, not intended to be shown to users. 1. SELECT * from EMPLOYEE where (Employee_name =" " or 1=1) AND (Password=" " or 1 =1) Unit-9 SQL Concepts Q-23 Explain DDL and DML with Syntax. Ans-: DDL - DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.  CREATE - to create a database and its objects like (table, index, views, store procedure, function, and triggers)  ALTER - alters the structure of the existing database  DROP - delete objects from the database  TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed  COMMENT - add comments to the data dictionary  RENAME - rename an object DML - DML is short name of Data Manipulation Language which deals with data manipulation and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE, etc., and it is used to store, modify, retrieve, delete and update data in a database.  SELECT - retrieve data from a database  INSERT - insert data into a table  UPDATE - updates existing data within a table  DELETE - Delete all records from a database table  MERGE - UPSERT operation (insert or update)  CALL - call a PL/SQL or Java subprogram  EXPLAIN PLAN - interpretation of the data access path  LOCK TABLE - concurrency Control Q-24 Explain following Term. (1) PRIMARY KEY - A primary key is a column -- or a group of columns -- in a table that uniquely identifies the rows in that table. For example, in the table below, Customer No, which displays the ID number assigned to different customers, is the primary key. (2) CANDIDATE KEY- Candidate key is a single key or a group of multiple keys that uniquely identify rows in a table. A Candidate key is a subset of Super keys and is devoid of any unnecessary attributes that are not important for uniquely identifying tuples. (3) SUPER KEY - The set of attributes that can uniquely identify a tuple is known as Super Key. For Example, STUD_NO, (STUD_NO, STUD_NAME), etc. Adding zero or more attributes to the candidate key generates the super key. A candidate key is a super key but vice versa is not true. (4) ON DELETE CASCADE - ON DELETE CASCADE clause in MySQL is used to automatically remove the matching records from the child table when we delete the rows from the parent table. It is a kind of referential action related to the foreign key. (5) ON DELETE SET NULL - On Delete Set Null clause sets all the records of the column which is defined as a foreign key in the child table to Null if the corresponding record in the parent table is deleted. (6) NOT NULL - The NOT NULL constraint is used to ensure that a given column of a table is never assigned the null value. Once a NOT NULL constraint has been defined for a particular column, any insert or update operation that attempts to place a null value in that column will fail. (7) UNIQUE - A unique key in DBMS is a key that is able to identify all the records of a table uniquely. (8) FORIGN KEY - A foreign key is the one that is used to link two tables together via the primary key. It means the columns of one table points to the primary key attribute of the other table. (9) CHECK - CHECK constraint is used to restrict the value of a column between a ranges. It performs check on the values, before storing them into the database. It’s like condition checking before saving data into a column. (10) Instance and Schema – Instance- An instance is defined as the data or collection of information stored in a database at a particular moment of time. Schema - Schema is defined as the overall description of the database, or simply it is the design of a database. Q-25 Explain Aggregate functions with example. Ans: Aggregate functions are count, min, max,sum,avg They are used tocompute a single value from a set of attribute values of a column: Count() Returns the number of rows that matches a specified condition. Default it returns total number of records. Example: How many tuples are stored in the relation EMP? select count(*) from EMP; COUNT(*) ---------- 14 Example: How many different job titles are stored in the relation EMP? select count(JOB) from EMP; COUNT(JOB) ------------------ 5 Max() Returns the largest value of the selected column. Example: Display maximum salary. select max(salary) from EMP; MAX(salary) ---------- 80000 Min () Returns the smallest value of the selected column. Example: Display minimum salary. select minimum(salary) from EMP; minimum(salary) ---------- 5000 Example: Compute the difference between the minimum and maximum salary. SQL> select max(salary) - min(salary) from EMP; MAX(SAL)-MIN(SAL) ----------------- 4200 Sum() Returns the total sum of a numeric column. Example: Sum of all salaries of employees working in the department 30. SQL> select sum(salary) from EMP SUM(SALary) ---------- 540000 SQL> select sum(salary) from EMPwhere DEPTNO = SUM(salary) ---------- 94000 Avg() Returns the average value of a numeric column. SQL> select avg(salary) from EMP; AVG(SAL) ---------- 2073.21429 Q-26 Explain Types of SQL Join. Ans: A SQL Join statement is used to combine data or rows from two or more tables based on a common field between them. Different types of Joins are :  INNER JOIN  LEFT JOIN  RIGHT JOIN  FULL JOIN Consider the two tables below: Student StudentCourse The simplest Join is INNER JOIN. 1. INNER JOIN: The INNER JOIN keyword selects all rows from both the tables as long as the condition satisfies. This keyword will create the result set by combining all rows from both the tables where the condition satisfies i.e value of the common field will be same. Syntax: SELECT table1.column1,table1.column2,table2.column1,.... FROM table1 INNER JOIN table2 ON table1.matching_column = table2.matching_column; table1: First table. table2: Second table matching_column: Column common to both the tables. 1. Note: We can also write JOIN instead of INNER JOIN. JOIN is same as INNER JOIN. 1. Example Queries(INNER JOIN) 1.  This query will show the names and age of students enrolled in different courses. SELECT StudentCourse.COURSE_ID, Student.NAME, Student.AGE FROM Student INNER JOIN StudentCourse ON Student.ROLL_NO = StudentCourse.ROLL_NO;  Output: 1. LEFT JOIN: This join returns all the rows of the table on the left side of the join and matching rows for the table on the right side of join. The rows for which there is no matching row on right side, the result-set will contain null. LEFT JOIN is also known as LEFT OUTER JOIN. Syntax: SELECT table1.column1,table1.column2,table2.column1,.... FROM table1 LEFT JOIN table2 ON table1.matching_column = table2.matching_column; table1: First table. table2: Second table matching_column: Column common to both the tables. 1. Note: We can also use LEFT OUTER JOIN instead of LEFT JOIN, both are same. Example Queries(LEFT JOIN): 1. SELECT Student.NAME,StudentCourse.COURSE_ID FROM Student LEFT JOIN StudentCourse ON StudentCourse.ROLL_NO = Student.ROLL_NO; 1. Output: 1. RIGHT JOIN: RIGHT JOIN is similar to LEFT JOIN. This join returns all the rows of the table on the right side of the join and matching rows for the table on the left side of join. The rows for which there is no matching row on left side, the result-set will contain null. RIGHT JOIN is also known as RIGHT OUTER JOIN. Syntax: SELECT table1.column1,table1.column2,table2.column1,.... FROM table1 RIGHT JOIN table2 ON table1.matching_column = table2.matching_column; table1: First table. table2: Second table matching_column: Column common to both the tables. 1. Note: We can also use RIGHT OUTER JOIN instead of RIGHT JOIN, both are same. 1. Example Queries(RIGHT JOIN): 1. SELECT Student.NAME,StudentCourse.COURSE_ID FROM Student RIGHT JOIN StudentCourse ON StudentCourse.ROLL_NO = Student.ROLL_NO; 1. Output: 1. FULL JOIN: FULL JOIN creates the result-set by combining result of both LEFT JOIN and RIGHT JOIN. The result-set will contain all the rows from both the tables. The rows for which there is no matching, the result-set will contain NULL values. Syntax: SELECT table1.column1,table1.column2,table2.column1,.... FROM table1 FULL JOIN table2 ON table1.matching_column = table2.matching_column; table1: First table. table2: Second table matching_column: Column common to both the tables. 1. Example Queries(FULL JOIN): 1. SELECT Student.NAME,StudentCourse.COURSE_ID FROM Student FULL JOIN StudentCourse ON StudentCourse.ROLL_NO = Student.ROLL_NO; 1. Output: Q-27 Write a query to find the names of employees that begin with ‘S’ Ans: SELECT * FROM EmployeeInfo WHERE EmpFname LIKE 'S%'; Q-28 Write a query to fetch the department-wise count of employees sorted by department’s count in ascending order. Ans: Select Department ,count(EmpId) AS EmpDeptCount From EmployeeInfo GroupBy Department ORDER BY EmpDeptCount ASC; Q-29 Write a query to retrieve the list of employees working in the same department. Ans: select DISTINCT E.Empid , E. Empname, E.Department FROM EmployeeInfo E, Employee E1 Where E. Department=E1. Department AND E.EmpID !=E1. EmpID; Q-30 Write a query to fetch all the records from the EmployeeInfo table ordered by EmpLname in descending order and Department in the ascending order. Ans: SELECT * FROM EmployeeInfo ORDER BY EmpFname desc, Department asc; 😊 Good Luck On Your Exams 😊

  • Operating System IMP Que. (BCA sem-ii)

    Bachelor Computer Application (BCA) Operating System (OS) Most important question banks UNIT - 1 Unit 1 Q.1) What is Operating System? Explain different functions of OS. => OS : ➢ Operating system is a collection of set of programs. ➢ Which manage all the resources of the computer system. ➢ It is an intermediator between the user and hardware ➢ A computer system can be divided into three components: 1. The hardware 2. Systems programs 3. Application programs ❖ Function of OS :- ➢ Memory management : The task of allocation and de-allocation of memory space to programs in need of this resources. ➢ Processor management : The OS assigns processor to the different task that must performed by the computer system. ➢ Device management : OS performs the task of allocation and de-allocation of the devices. ➢ File management : OS manages all the file-related activities such as organization storage, retravel, naming, sharing, and protection of files. ➢ Security management : It helps OS, that secure and protect the computer system internally as well as externally. ➢ Job scheduling : It is the process of allocating system resources to many different task by an OS. ➢ Time sharing : It co-ordinate and assigns compilers, assemblers, utility programs, and other software packages to various users working on computer system. Q.2) Explain block diagram of computer. => Computer Block Diagram System: 👉 Mainly computer system consists of three parts, that are central processing unit (CPU), Input Devices, and Output Devices. The Central Processing Unit (CPU) is divided into two parts again: arithmetic logic unit (ALU) and the control unit (CU). The set of instruction is in the form of raw data. 👉A large amount of data is stored in the computer memory with the help of primary and secondary storage devices. The CPU is like the heart/brain of the computer. The user does not get the desired output, without the necessary option taken by the CPU. The Central processing unit (CPU) is responsible for the processing of all the instructions which are given by the user to the computer system. 👉 The data is entered through input devices such as the keyboard, mouse, etc. This set of instruction is processed by the CPU after getting the input by the user, and then the computer system produces the output. The computer can show the output with the help of output devices to the user, such as monitor, printer, etc. CPU (Central Processing Unit):- The computer system is nothing without the Central processing Unit so, it is also known as the brain or heat of computer. The CPU is an electronic hardware device which can perform different types of operations such as arithmetic and logical operation. The CPU contains two parts: the arithmetic logic unit and control unit. We have discussed briefly the arithmetic unit, logical unit, and control unit which are given below: Control Unit:- The control unit (CU) controls all the activities or operations which are performed inside the computer system. It receives instructions or information directly from the main memory of the computer. When the control unit receives an instruction set or information, it converts the instruction set to control signals then; these signals are sent to the central processor for further processing. The control unit understands which operation to execute, accurately, and in which order. Arithmetic and Logical Unit:- The arithmetic and logical unit is the combinational digital electronic circuit that can perform arithmetic operations on integer binary numbers.It presents the arithmetic and logical operation. The outputs of ALU will change asynchronously in response to the input. The basic arithmetic and bitwise logic functions are supported by ALU. Storage Unit:- The information or set of guidelines are stored in the storage unit of the computer system. The storage unit provides the space to store the data or instruction of processed data. The information or data is saved or hold in computer memory or storage device. The data storage is the core function and fundamental of the computer components. Q.3)Explain the architecture of OS. =>The core software components of an operating system are collectively known as the kernel. The kernel has unrestricted access to all of the resources on the system. In early monolithic systems, each component of the operating system was contained within the kernel, could communicate directly with any other component, and had unrestricted system access. While this made the operating system very efficient, it also meant that errors were more ● As operating systems became larger and more complex, this approach was largely abandoned in favour of a modular approach which grouped components with similar functionality into layers to help operating system designers to manage the complexity of the system. In this kind of architecture, each layer communicates only with the layers immediately above and below it, and lower level layers provide services to higher-level ones using an interface that hides their implementation. ● The modularity of layered operating systems allows the implementation of each layer to be modified without requiring any modification to adjacent layers. Although this modular approach imposes structure and consistency on the operating system, simplifying debugging and modification, a service request from a user process may pass through many layers of system software before it is serviced and performance compares unfavourably to that of a monolithic kernel. Also, because all layers still have unrestricted access to the system, the kernel is still susceptible to errant or malicious code. Many of today’s operating systems, including Microsoft Windows and Linux, implement some level of layering. ● A microkernel architecture includes only a very small number of services within the kernel in an attempt to keep it small and scalable. The services typically include low-level memory management, inter- process communication and basic process synchronisation to enable processes to cooperate. In microkernel designs, most operating system components, such as process management and device management, execute outside the kernel with a lower level of system access. ● Microkernels are highly modular, making them extensible, portable and scalable. Operating system components outside the kernel can fail without causing the operating system to fall over. Once again, the downside is an increased level of inter- module communication which can degrade system performance. Q.4)What is the goal of OS ? => There are two types of goals of an Operating System i.e. Primary Goals and Secondary Goal. ● Primary Goal: The primary goal of an Operating System is to provide a user-friendly and convenient environment. We know that it is not compulsory to use the Operating System, but things become harder when the user has to perform all the process scheduling and converting the user code into machine code is also very difficult. So, we make the use of an Operating System to act as an intermediate between us and the hardware. All you need to do is give commands to the Operating System and the Operating System will do the rest for you. So, the Operating System should be convenient to use. ● Secondary Goal: The secondary goal of an Operating System is efficiency. The Operating System should perform all the management of resources in such a way that the resources are fully utilised and no resource should be held idle if some request to that resource is there at that instant of time. Q.5)Explain different type of OS. [A].Batch OS:- ● Batch processing requires grouping of similar jobs which consist of programs and data. Batch processing is suitable for program with large computation time with no need for user interaction. Initially serial system was used where execution of program is sequential, but it was very slow Computer operator gives a command to start the processing of a batch, the kernel set up the processing of the first job. Job was selected from the job queue and loaded into main memory when a job completed execution its memory was released and the output for the job was copied .When a job is completed it returns control, which immediately reads in the next job. Following figure shows the concept of a batch system. Advantages: • Processors of the batch systems are aware of the time duration of the job even when it is present in the queue. • Batch systems can be shared by multiple users. • There is very less idle time of the batch system. • It enables us to manage an efficiently large load of work. Disadvantages: • It is very difficult to debug the batch systems . • proves to be costly sometimes. ● If any job fails, then it is difficult to It predict the time. [B].Multiprogramming OS:- ⨁ CPU remains idle in batch system. At any time either CPU or I/O device was idle in batch system to keep CPU busy, more than one program job must be loaded for execution. It increases the CPU utilization. OS executes multiple programs. One program gives control to other program when it is waiting for some I/O or when it completes its execution. Here CPU Scheduling is required. Memory management is also require. Advantages :- • No CPU idle time. • Tasks runs in parallel. • Shorter response time. • Maximizes total job throughput of a computer. • Increases resource utilization. Disadvantages:- • Sometimes long time jobs have to wait long time. • Tracking of all processes sometimes difficult.. • Requires efficient memory management. • No user interaction with any program during execution. [C].Multitasking OS:- Multitasking means that the computer can deal with more than one program at a time. Here CPU scheduling must be given. Here every process is having its PCB (Process Control Block ). Which stores all registers, memory, etc. When one program gives control of CPU to other program before its execution, it is called as context switching. Advantages :-  It provides logical parallelism.  It provides a shorter response time.  It provides CPU utilization. Disadvantages :  It couldn't be executed on a slow-speed processor.  It needs a large amount of storage memory to do the work. [D].Time Sharing OS:- In case of multiprogramming only one program runs at a time, that program gives control to other program when it will complete its tasks. It means if we have more processes then last process has to wait for very long time. To avoid this time sharing OS is used where certain time slot is allocated to every program. It will get CPU only its given time slot. After that CPU will be hand over to other program. Here most of the time round robin scheduling is used. It is more complex than time sharing OS. Advantages: • Duplication of software is less probable • Each task is given equal importance • The CPU idle time can be decreased Disadvantages:-  Problem of reliability  Care of security and integrity is to be taken of user data and programs  There is a problem in data communication [E].Distributed OS:-  A Distributed operating system is one that looks to its users like an ordinary centralized operating system but runs on multiple independent CPU. User sees the environment as a virtual environment. Here client-server mechanism is used. Users request OS service to the server. Server gives a response to that request. Distributed OS allows programs to run on several processors at the same time without users being aware of this distribution. Distributed systems are more reliable than uniprocessor-based systems. The distributed system has a performance advantage over traditional centralized systems. It is simple to implement. But that is also a disadvantage for distributed systems. Advantages: • The data exchange speed is increased by using electronic mails • All systems are entirely independent]et of each other. • Failure of one system is not going to affect the other • The resources are shared and hence the computation is very fast and speedy • There is a reduction in load on their host computers • Delay in processing reduces Disadvantages: • If the main network fails, this will stop the complete communication. • To establish such systems, the language which is used are not clearly and well defined still. • They are very expensive. • The underlying software is highly complex. [F].Parallel Computing:-  The use of multiple computers with multiple processes to solve a problem with greater speed than using a single computer.  The use of multiple computers with multiple processes to solve a problem with greater speed than using a single computer.ng is dividing up tasks ver multiple microprocessors which are independent of each other. Instructions from each part execute simultaneously on different CPU. Advantages :- • It saves time and money as many resources working together will reduce the time and cut potential costs. • It can be impractical to solve larger problems on Serial Computing. • It can take advantage of non-local resources when the local resources are finite. • Serial Computing ‘wastes’ the potential computing power, thus Parallel Computing makes better work of the hardware. Disadvantages: • It addresses such as communication and synchronization between multiple sub-tasks and processes which is difficult to achieve.  The algorithms must be managed in such a way that they can be handled in a parallel mechanism.  The algorithms or programs must have low coupling and high cohesion. But it’s difficult to create such programs  More technically skilled and expert programmers can code a parallelism-based program well. [G].Real Time OS:- ⨀Time constraints is the key parameter in real time operating system. It is used in air traffic control, satellite, etc. Real time system. Are of two types. Hard real time and soft real time critical task is completed within the time limit in hard real time system. Soft real time cannot guarantee that it will be able to meet deadline under all condition. Advantages: • Maximum use of devices and system thus gives more output from all the resources • Time given for shifting tasks is very less • It Focusses on running applications and gives less importance to queue applications • Size of programs are small • Error free • Memory allocation is well managed Disadvantages:- • Only some task run at the same time • Sometimes the system resources are not good enough and they are costly as well • Complex and difficult to write algorithms are used • It requires specific device drivers • They are very less prone to switching tasks 1. [6]. Differentiate user level threads from kernel level threads. =>There are two types of threads. 1. User Level Thread 2. Kernel Level Thread Kernel level thread The kernel thread recognizes the operating system. There is a thread control block and process control block in the system for each thread and process in the kernel-level thread. The kernel-level thread is implemented by the operating system. The kernel knows about all the threads and manages them. The kernel-level thread offers a system call to create and manage the threads from user-space. The implementation of kernel threads is more difficult than the user thread. Context switch time is longer in the kernel thread. If a kernel thread performs a blocking operation, the Banky thread execution can continue. Example: Window Solaris. Advantages of Kernel-level threads:- • The kernel-level thread is fully aware of all threads. • The scheduler may decide to spend more CPU time in the process of threads being large numerical. • The kernel-level thread is good for those applications that block the frequency. Disadvantages of Kernel-level threads:- 1. The kernel thread manages and schedules all threads. 2. The implementation of kernel threads is difficult than the user thread. 3. The kernel-level thread is slower than user-level threads. Unit- 2 1. What is PCB? Explain all attributes of PCB.  Every process is represented in the operating system by a process control block, which is also called a task control block. Process state: A process can be new, ready, running, waiting, etc. Program counter: The program counter lets you know the address of the next instruction, which should be executed for that process. CPU registers: This component includes accumulators, index and general-purpose registers, and information of condition code. CPU scheduling information: This component includes a process priority, pointers for scheduling queues, and various other scheduling parameters. Accounting and business information: It includes the amount of CPU and time utilities like real time used, job or process numbers, etc. Memory-management information: This information includes the value of the base and limit registers, the page, or segment tables. This depends on the memory system, which is used by the operating system. I/O status information: This block includes a list of open files, the list of I/O devices that are allocated to the process, etc. 2.What is process? Explain process life cycle.  Process is the execution of a program that performs the actions specified in that program. It can be defined as an execution unit where a program runs. The OS helps you to create, schedule, and terminates the processes which is used by CPU. A process created by the main process is called a child process. 3. What is process scheduling? Explain scheduling algorithms with suitable example.  A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. There are six popular process scheduling algorithms which we are going to discuss in this chapter.  These algorithms are either non-preemptive or preemptive. Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state. Priority Based Scheduling:-  Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems. Each process is assigned a priority. Process with highest priority is to be executed first and so on.  Each process is assigned a priority. Process with highest priority is to be executed first and so on.  Priority can be decided based on memory requirements, time requirements or any other resource requirement. 4.Difference between preemptive and nonpreemptive. 5.Explain FCFS scheduling algorithm with its advantages and disadvantages(prepare all scheduling algorithm like this).  These algorithms are either non-preemptive or preemptive. Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state.  First Come First Serve (FCFS) :- • Jobs are executed on first come, first serve basis. • It is a non-preemptive, pre-emptive scheduling algorithm. • Easy to understand and implement. • Its implementation is based on FIFO queue. • Poor in performance as average wait time is high. 6.flow of execution of tasks of a process so it is also known Explain following terms: Turn around time, Execution Time, Arrival Time, waiting Time, Thread. 1. Turn around time: -> Turnaround time (TAT) is the amount of time taken to complete a process or fulfill a request. The concept thus overlaps with lead time and can be contrasted with cycle time. 2. Execution time: ->The execution time or CPU time of a given task is defined as the time spent by the system executing that task, including the time spent executing run- time or system services on its behalf. The mechanism used to measure execution time is implementation defined. 3. Arriving time: -> Definitions of arrival time. the time at which a public conveyance is scheduled to arrive at a given destination. synonyms: time of arrival. 4. Waiting time: -> Waiting time is the total time spent by the process in the ready state waiting for CPU. For example, consider the arrival time of all the below 3 processesto be 0 ms, 0 ms, and 2 ms and we are using the First Come First Serve scheduling algorithm. Then the waiting time for all the 3 processes will be: P1: 0 ms. 5 .Thread: -> A thread is a single sequential as thread of execution or thread of control. There is a way of thread execution inside the process of any operating system. Apart from this, there can be more than one thread inside a process. 7.Find Average waiting time using priority based scheduling algorithm. => UNIT – 3 1. What is Race Condition ? ❖ RACE CONDITION: • A race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. • A race condition is a situation that may occur inside a critical section. This happens when the result of multiple thread execution in critical section differs according to the order in which the threads execute. : Ex : Dual Switch • Race conditions in critical sections can be avoided if the critical section is treated as an atomic instruction. Also, proper thread synchronization using locks or atomic variables can prevent race conditions. 2. What is Critical section ? Explain three conditions of Critical Sections. ❖ CRITICAL SECTION: • The critical section in a code segment where the shared variables can be accessed. Atomic action is required in a critical section i.e. only one process can execute in its critical section at a time. All the other processes have to wait to execute in their critical sections. • a critical section may be used to ensure that a shared resource, for example, a printer, can only be accessed by one process at a time. • The entry sections handles the entry into the critical section. It acquires the resources needed for execution by the process. The exit section handles the exit from the critical section. It releases the resources and also informs the other processes that critical section is free. • The critical section problem needs a solution to synchronize the different processes. The solution to the critical section problem must satisfy the following conditions − • Mutual Exclusion Mutual exclusion implies that only one process can be inside the critical section at any time. If any other processes require the critical section, they must wait until it is free. • Progress Progress means that if a process is not using the critical section, then it should not stop any other process from accessing it. In other words, any process can enter a critical section if it is free • Bounded Waiting Bounded waiting means that each process must have a limited waiting time. It should not wait endlessly to access the critical section. 3. Explain Peterson’s Algorithm. ❖ PETERSON’S SOLUTION:- • Peterson's Solution preserves all three conditions : Mutual Exclusion is assured as only one process can access the critical section at any time. Progress is also assured, as a process outside the critical section does not block other processes from entering the critical section. • This is a software mechanism implemented at user mode. It is a busy waiting solution can be implemented for only two processes. It uses two variables that are turn variable and interested variable. • the Peterson solution provides you all the necessary requirements such as Mutual Exclusion, Progress, Bounded Waiting and Portability. • Peterson’s Algorithm is used to synchronize two processes. It uses two variables, a bool array flag of size 2 and an int variable turn to accomplish it. In the solution i represents the Consumer and j represents the Producer. Initially the flags are false. When a process wants to execute it’s critical section, it sets it’s flag to true and turn as the index of the other process. • This means that the process wants to execute but it will allow the other process to run first. The process performs busy waiting until the other process has finished it’s own critical section. After this the current process enters it’s critical section and adds or removes a random number from the shared buffer. After completing the critical section, it sets it’s own flag to false, indication it does not wish to execute anymore. • The program runs for a fixed amount of time before exiting. This time can be changed by changing: # define N 2 # define TRUE 1 # define FALSE 0 int interested[N] = FALSE; int turn; voidEntry_Section (int process) { int other; other = 1-process; interested[process] = TRUE; turn = process; while (interested [other] =True && TURN=process); } voidExit_Section (int process) { interested [process] = FALSE; } 4. Explain Following Term: Race Condition, Critical Section, Hardware Solution, Mutex Lock, Semaphore. ❖ RACE CONDITION :- • A race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. • A race condition is a situation that may occur inside a critical section. This happens when the result of multiple thread execution in critical section differs according to the order in which the threads execute. : Ex : Dual Switch • Race conditions in critical sections can be avoided if the critical section is treated as an atomic instruction. Also, proper thread synchronization using locks or atomic variables can prevent race conditions. ❖ CRITICAL SECTION :- • The critical section in a code segment where the shared variables can be accessed. Atomic action is required in a critical section i.e. only one process can execute in its critical section at a time. All the other processes have to wait to execute in their critical sections. • a critical section may be used to ensure that a shared resource, for example, a printer, can only be accessed by one process at a time. • The entry sections handles the entry into the critical section. It acquires the resources needed for execution by the process. The exit section handles the exit from the critical section. It releases the resources and also informs the other processes that critical section is free. • The critical section problem needs a solution to synchronize the different processes. The solution to the critical section problem must satisfy the following conditions − • Mutual Exclusion Mutual exclusion implies that only one process can be inside the critical section at any time. If any other processes require the critical section, they must wait until it is free. • Progress Progress means that if a process is not using the critical section, then it should not stop any other process from accessing it. In other words, any process can enter a critical section if it is free • Bounded Waiting Bounded waiting means that each process must have a limited waiting time. It should not wait endlessly to access the critical section. ❖ HARDWARE SOLUTION :- • The hardware-based solution to critical section problem is based on a simple tool i.e. lock. The solution implies that before entering into the critical section the process must acquire a lock and must release the lock when it exits its critical section. Using of lock also prevent the race condition . ❖ MUTUAL EXCLUSION :- • A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource. This concept is used in concurrent programming with a critical section, a piece of code in which processes or threads access a shared resource. ❖ SEMAPHORE :- • Semaphore is simply an integer variable that is shared between threads. This variable is used to solve the critical section problem and to achieve process synchronization in the multiprocessing environment. This is also known as mutex lock. It can have only two values – 0 and 1 • A mutex object allows multiple process threads to access a single shared resource but only one at a time. • semaphore allows multiple process threads to access the finite instance of the resource until available. In mutex, the lock can be acquired and released by the same process at a time. Unit-4 1. What is Deadlock? Explain the conditions that lead to deadlock.  Deadlock Is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. Consider an example when two trains are coming toward each other on the same track and there is only one track, none of the trains can move once they are in front of each Other.  A process in operating system uses resources in the following way. 1) Requests a resource 2) Use the resource 3) Releases the resource  A similar situation occurs in operating systems when there are two or more processes that hold some resources and wait for resources held by other(s). For example, in the below diagram, Process 1 is holding Resource 1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource 1.  Deadlock can arise if the following four conditions hold simultaneously (Necessary Conditions) Mutual Exclusion: Two or more resources are non-shareable (Only one process can use at a time) Hold and Wait: A process is holding at least one resource and waiting for resources. No preemption:-A resource cannot be taken from a process unless the process releases the resource. Circular Wait: A set of processes are waiting for each other in circular form. 2.In which different conditions required to arise deadlock?  Conditions for Deadlock in Operating System : Deadlock is a situation which involves the interaction of more than one resources and processes with each other. We can visualise the occurrence of deadlock as a situation where there are two people on a staircase. One is ascending the staircase while the other is descending. The staircase is so narrow that it can only fit one person at a time. As a result, one has to retreat while the other moves on and uses the staircase. Once that person has finished, the other one can use that staircase. But here, neither person is willing to retreat and waits for the other to retreat. None of them are able to use the staircase. The people here are the processes, and the staircase is the resource. When a process requests for the resource that is been held another process which needs another resource to continue, but is been held by the first process, then it is called a deadlock.  There are four conditions necessary for the occurrence of a deadlock. They can be understood with the help of the above illustrated example of staircase: 1. Mutual Exclusion: When two people meet in the landings, they can't just walk through because there is space only for one person. This condition allows only one person (or process) to use the step between them (or the resource) is the first condition necessary for the occurrence of the deadlock. 2. Hold and Wait: When the two people refuse to retreat and hold their ground, it is called holding. This is the next necessary condition for deadlock. 3. No Preemption: For resolving the deadlock one can simply cancel one of the processes for other to continue. But the Operating System doesn't do so. It allocates the resources to the processors for as much time as is needed until the task is completed. Hence, there is no temporary reallocation of the resources. It is the third condition for deadlock. 4. Circular Wait: When the two people refuse to retreat and wait for each other to retreat so that they can complete their task, it is called circular wait. It is the last condition for deadlock to occur. Note: All four conditions are necessary for deadlock to occur. If any single one is prevented or resolved, the deadlock is resolved. 3.Explain deadlock detection situations.  Deadlock Detection: 1. If resources have a single instance - In this case for Deadlock detection, we can run an algorithm to check for the cycle in the Resource Allocation Graph. The presence of a cycle in the graph is a sufficient condition for deadlock. 2.In the above diagram, resource 1 and resource 2 have single instances. There is a cycle R1 → P1 → R2 is Confirmed. P2. So, Deadlock. 3. If there are multiple instances of resources - Detection of the cycle is necessary but not sufficient condition for deadlock detection, in this case, the system may or may not be in deadlock varies according to different situations. 4. Explain Banker’s algorithm.  banker algorithm used to avoid deadlock and allocate resources safely to each process in the computer system. The 'S-State' examines all possible tests or activities before deciding whether the allocation should be allowed to each process. It also helps the operating system to successfully share the resources between all the processes. The banker's algorithm is named because it checks whether a person should be sanctioned a loan amount or not to help the bank system safely simulate allocation resources. In this section, we will learn the Banker's Algorithm in detail. Also, we will solve problems based on the Banker's Algorithm. To understand the Banker's Algorithm first we will see a real word example of it.  Suppose the number of account holders in a particular bank is 'n', and the total money in a bank is 'T'. If an account holder applies for a loan; first, the bank subtracts the loan amount from full cash and then estimates the cash difference is greater than T to approve the loan amount. These steps are taken because if another person applies for a loan or withdraws some amount from the bank, it helps the bank manage and operate all things without any restriction in the functionality of the banking system.  Similarly, it works in an operating system. When a new process is created in a computer system, the process must provide all types of information to the operating system like upcoming processes, requests for their resources, counting them, and delays. Based on these criteria, the operating system decides which process sequence should be executed or waited so that no deadlock occurs in a system. Therefore, it is also known as deadlock avoidance algorithm or deadlock detection in the operating system. UNIT – 5 1. What is Memory Management ? • Memory partitioning Memory partitioning means dividing the main memory into chunks of the same or different sizes so that they can be assigned to processes in the main memory. There are two Memory Management techniques: Contiguous, and Non-Contiguous. In Contiguous Technique, executing process must be loaded entirely in the main memory. Contiguous Technique can be divided into: 1. Fixed (or static) partitioning 2. Variable (or dynamic) partitioning ▪ Fixed Partitioning: This is the oldest and simplest technique used to put more than one process in the main memory. In this partitioning, the number of partitions (non-overlapping) in RAM is fixed but the size of each partition may or may not be the same. In above figure, first process is only consuming 1MB out of 4MB in the main memory. Hence, Internal Fragmentation in first block is (4-1) = 3MB. Sum of Internal Fragmentation in every block = (4-1)+(8-7)+(8-7)+(16-14)= 3+1+1+2 = 7MB. Suppose process P5 of size 7MB comes. But this process cannot be accommodated in spite of available free space because of contiguous allocation. • Advantages of Fixed Partitioning – 1. Easy to implement 2. Little OS overhead • Disadvantages of Fixed Partitioning – 1. Internal Fragmentation 2. External Fragmentation 3. Limit process size 4. Limitation on Degree of Multiprogramming • Variable Partitioning – It is a part of Contiguous allocation technique. It is used to alleviate the problem faced by Fixed Partitioning. In contrast with fixed partitioning, partitions are not made before the execution or during system configure. • Advantages of Variable Partitioning – 1. No Internal Fragmentation 2. No restriction on Degree of Multiprogramming 3. No Limitation on the size of the process • Disadvantages of Variable Partitioning – 1. Difficult Implementation 2. External Fragmentation 2. What is static and Dynamic linking ? • Static Linking: When we click the .exe (executable) file of the program and it starts running, all the necessary contents of the binary file have been loaded into the process’s virtual address space. However, most programs also need to run functions from the system libraries, and these library functions also need to be loaded. In the simplest case, the necessary library functions are embedded directly in the program’s executable binary file. Such a program is statically linked to its libraries, and statically linked executable codes can commence running as soon as they are loaded. • Disadvantage: Every program generated must contain copies of exactly the same common system library functions. In terms of both physical memory and disk-space usage, it is much more efficient to load the system libraries into memory only once. Dynamic linking allows this single loading to happen. • Dynamic Linking: Every dynamically linked program contains a small, statically linked function that is called when the program starts. This static function only maps the link library into memory and runs the code that the function contains. The link library determines what are all the dynamic libraries which the program requires along with the names of the variables and functions needed from those libraries by reading the information contained in sections of the library. After which it maps the libraries into the middle of virtual memory and resolves the references to the symbols contained in those libraries. We don’t know where in the memory these shared libraries are actually mapped: They are compiled into position-independent code (PIC), that can run at any address in memory. • Advantage: Memory requirements of the program are reduced. A DLL is loaded into memory only once, whereas more than one application may use a single DLL at the moment, thus saving memory space. Application support and maintenance costs are also lowered. 3. How the swapping process run in the OS ? • Swapping : The process of swapping means removing all the pages of the process from memory, or marking the pages so that we can remove the pages with the help of the page replacement process. If the process is suspended, it means the process cannot run. but we can swap out the process for sometime. After some time, the process can be swapped back by the system from the secondary memory to the primary memory. 4. What is Fragmentation? ▪ Fragmentation: A Fragmentation is defined as when the process is loaded and removed after execution from memory, it creates a small free hole. These holes can not be assigned to new processes because holes are not combined or do not fulfill the memory requirement of the process. In operating system two types of fragmentation: • Internal fragmentation: Occurs when memory blocks are allocated to the process more than their requested size. Due to this some unused space is leftover and creates an internal fragmentation problem. • External fragmentation: In external fragmentation, we have a free memory block, but we can not assign it to process because blocks are not contiguous. 5. Explain Internal & External Fragmentation? • Fragmentation: A Fragmentation is defined as when the process is loaded and removed after execution from memory, it creates a small free hole. These holes can not be assigned to new processes because holes are not combined or do not fulfill the memory requirement of the process. In operating system two types of fragmentation: ▪ Internal fragmentation: Occurs when memory blocks are allocated to the process more than their requested size. Due to this some unused space is leftover and creates an internal fragmentation problem. Example: Suppose there is a fixed partitioning is used for memory allocation and the different size of block 3MB, 6MB, and 7MB space in memory. Now a new process p4 of size 2MB comes and demand for the block of memory. It gets a memory block of 3MB but 1MB block memory is a waste, and it can not be allocated to other processes too. This is called internal fragmentation. ▪ External fragmentation: In external fragmentation, we have a free memory block, but we can not assign it to process because blocks are not contiguous. Example: Suppose (consider above example) three process p1, p2, p3 comes with size 2MB, 4MB, and 7MB respectively. Now they get memory blocks of size 3MB, 6MB, and 7MB allocated respectively. After allocating process p1 process and p2 process left 1MB and 2MB. Suppose a new process p4 comes and demands a 3MB block of memory, which is available, but we can not assign it because free memory space is not contiguous. This is called external fragmentation. 😊 Good Luck On Your Exams 😊

  • Data Structure IMP Que. (BCA sem-ii)

    Bachelor Computer Application (BCA) Data Structure Most important question banks Unit : 1 1.Difference between primitive and non-primitive data structure: 2.Explain Advantages of Data Structure: • Data structure helps in efficient storage of data in the storage device. • Data structure usage provides convenience while retrieving the data from storage device. • Data structure provides effective and efficient processing of small as well as large amount of data. • Usage of proper data structure can help programmer save lots of time or processing time while operations such as storage, retrieval or processing of data. • Manipulation of large amount of data can be carried out easily with the use of good data structure approach. • Most of the well-organized data structures like Array, stack, queues, graph, tree, linked list has well-built and pre-planned approach for operations like storage, addition, retrieval, manipulation, deletion, etc. While using them, programmer can be completely rely on these data structures. • Data structure usage can simply encourage reusability in long run as well. 3.Explain Dataflow of an Algorithm, and why we need algorithms. Problem: A problem can be a real-world problem or any instance from the real-world problem for which we need to create a program or the set of instructions. The set of instructions is known as an algorithm. • Algorithm: An algorithm will be designed for a problem which is a step-by-step procedure. • Input: After designing an algorithm, the required and the desired inputs are provided to the algorithm • Processing unit: The input will be given to the processing unit, and the processing unit will produce the desired output. • Output: The output is the outcome or the result of the program. We need algorithms because of the following reasons: - • Scalability: It helps us to understand the scalability. When we have a big real-world problem, we need to scale it down into small-small steps to easily analyze the problem. • Performance: The real-world is not easily broken down into smaller steps. If the problem, can be easily broken into smaller steps means that the problem is feasible. 4.Explain space and time complexity of an algorithms. Suppose X is treated as an algorithm and N is treated as the size of input data, the time and space implemented by the Algorithm X are the two main factors which determine the efficiency of X. • Time Factor − The time is calculated or measured by counting the number of key operations such as comparisons in sorting algorithm. • Space Factor − The space is calculated or measured by counting the maximum memory space required by the algorithm. • The complexity of an algorithm f(N) provides the running time and / or storage space needed by the algorithm with respect of N as the size of input data. • Space Complexity • Space complexity of an algorithm represents the amount of memory space needed the algorithm in its life cycle. • Space needed by an algorithm is equal to the sum of the following two components: - -> Fixed part -> Variable part • A fixed part that is a space required to store certain data and variables (i.e. simple variables and constants, program size etc.), that are not dependent of the size of the problem. • A variable part is a space required by variables, whose size is totally dependent on the size of the problem. For example, recursion stack space, dynamic memory allocation etc. • Space complexity S(p) of any algorithm p is S(p) = A + Sp(I) Where A is treated as the fixed part and S(I) is treated as the variable part of the algorithm which depends on instance characteristic I. Following is a simple example that tries to explain the concept. Unit :2 5. What is Array? Explain in detail . ∙ Array is a container which can hold a fix number of items and these items should be of the same type. ∙ An array is a collection of homogeneous (same type) data items stored in contiguous memory locations. ∙ Element − Each item stored in an array is called an element. ∙ Index − Each location of an element in an array has a numerical index, which is used to identify the element. Why we need an array? Array is particularly useful when we are dealing with lot of variables of the same type. For example, let’s say I need to store the marks in math subject of 100 students. To solve this particular problem, either I have to create the 100 variables of int type or create an array of int type with the size 100. Obviously the second option is best, because keeping track of all the 100 different variables is a tedious task. On the other hand, dealing with array is simple and easy, all 100 values can be stored in the same array at different indexes (0 to 99). 6.What is Stack ? Explain Stack in detail. ∙ A Stack is a linear data structure that follows the LIFO (Last-In-First-Out) principle. Stack has one end. ∙ It contains only one pointer top pointer pointing to the topmost element of the stack. ∙ Whenever an element is added in the stack, it is added on the top of the stack, and the element can be deleted only from the stack. ∙ In other words, a stack can be defined as a container in which insertion and deletion can be done from the one end known as the top of the stack. Working of Stack ∙ Stack works on the LIFO pattern. As we can observe in the below figure there are five memory blocks in the stack; therefore, the size of the stack is 5. ∙ Suppose we want to store the elements in a stack and let's assume that stack is empty. We have taken the stack of size 5 as shown below in which we are pushing the elements one by one until the stack becomes full. ∙ The following are some common operations implemented on the stack: ∙ push(): When we insert an element in a stack then the operation is known as a push. If the stack is full then the overflow condition occurs. ∙ pop(): When we delete an element from the stack, the operation is known as a pop. If the stack is empty means that no element exists in the stack, this state is known as an underflow state. ∙ is Empty(): It determines whether the stack is empty or not. ∙ is Full(): It determines whether the stack is full or not.' ∙ peek(): It returns the element at the given position. ∙ count(): It returns the total number of elements available in a stack. ∙ change(): It changes the element at the given position. ∙ display(): It prints all the elements available in the stack. 7. Explain in detail : Representation of an Array. Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration. As per the above illustration, following are the important points to be considered. ● Index starts with 0. ● Array length is 10 which means it can store 10 elements. ● Each element can be accessed via its index. For example, we can fetch an element at index 6 as 27. Basic Operations : Following are the basic operations supported by an array. ● Traverse − print all the array elements one by one. ● Insertion − Adds an element at the given index. ● Deletion − Deletes an element at the given index. ● Search − Searches an element using the given index or by the value. ● Update − Updates an element at the given index. 8.write Advantages and Dis-advantages of an array. Advantages: ● A convenient way to store large amounts of similar data. ● It is used to represent multiple items of similar nature using a single name. ● It allows us to store data in multi-dimensional arrays. ( We will learn about them in a later section.) ● It is used to create other data structures like heaps, linked lists, etc. ● You need not access elements sequentially, random access is allowed. ● Since elements are stored in consecutive blocks hence they are useful to use in iterations. ● Since the size of the array is known during compile-time, there is no chance of memory run out for arrays. Dis-Advantages: ● Since it is a static data structure that is has a fixed size we should know or determine array size at compile time itself. No modifications can be done to array size during runtime. ● Inserting and deleting elements from an array is a tedious task, as it would involve shifting of some or all the elements of the array which would also involve managing memory space for it as well. ● Since we declare array at compile time itself with a particular size, it is possible that a lot of memory space might get wasted if only some address space is used and occupied. ● Operations like insertion, deletion are time-consuming tasks on arrays. 9.convert following infix notations to prefix notations and postfix notations. 1. a + b +ab ab+ 2. (a + b) ∗ c *+abc ab+c* 3. a ∗ (b + c) 4. a / b + c / d 5. ((a + b) ∗ c) – d 10.Explain push and pop operation with algorithm: PUSH operation: The steps involved in the PUSH operation is given below: ● Before inserting an element in a stack, we check whether the stack is full. ● If we try to insert the element in a stack, and the stack is full, then the overflow condition occurs. ● When we initialize a stack, we set the value of top as -1 to check that the stack is empty. ● When the new element is pushed in a stack, first, the value of the top gets incremented, i.e., top=top+1, and the element will be placed at the new position of the top. ● The elements will be inserted until we reach the max size of the stack. ● The process of putting a new data element onto stack is known as a Push Operation. Push operation involves a series of steps − ● Step 1 − Checks if the stack is full. ● Step 2 − If the stack is full, produces an error and exit. ● Step 3 − If the stack is not full, increments top to point next empty space. ● Step 4 − Adds data element to the stack location, where top is pointing. ● Step 5 − Returns success. POP operation: The steps involved in the POP operation is given below: ● Before deleting the element from the stack, we check whether the stack is empty. ● If we try to delete the element from the empty stack, then the underflow condition occurs. ● If the stack is not empty, we first access the element which is pointed by the top ● Once the pop operation is performed, the top is decremented by 1, i.e., top=top-1. ● A Pop operation may involve the following steps ● Step 1 − Checks if the stack is empty. ● Step 2 − If the stack is empty, produces an error and exit. ● Step 3 − If the stack is not empty, accesses the data element at which top is pointing. ● Step 4 − Decreases the value of top by 1. ● Step 5 − Returns success. Unit :- 3 11. What is queue? Explain basic operations of queue. A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). ▪ In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added. ▪ Queue is exactly how queue system works in real world. If you go to a ticket counter to buy movie tickets, and are first in the queue, then you will be the first one to get the tickets. ▪ The process to add an element into queue is called Enqueue and the process of removal of an element from queue is called Dequeue. Basic Operations of Queue :- ▪ enqueue() − add (store) an item to the queue. ▪ dequeue() − remove (access) an item from the queue. ▪ Few more functions are required to make the above-mentioned queue operation efficient. These are − ▪ peek() − Gets the element at the front of the queue without removing it. ▪ isfull() − Checks if the queue is full. ▪ isempty() − Checks if the queue is empty. 12. Write down the basic steps for enqueue() and dequeue() operation of queue. Explain with Example. Enqueue Operation: 1.check if the queue is full 2.for the first element, set the value of FRONT to 0 3.increase the REAR index by 1 4.add the new element in the position pointed to by REAR Dequeue Operation: 1.check if the queue is empty 2.return the value pointed by FRONT 3.increase the FRONT index by 1 4.for the last element, reset the values of FRONT and REAR to1 Example: Front: Get the front item from queue. Require mostly when deleting item. Rear: Get the last item from queue. Require mostly when adding item. Adding Element : - 13. Explain circular queue in detail. A circular queue is a linear data structure in which the operations are performed based on FIFO(First In First Out) principle and the last position is connected back to the first position to make a circle. ▪ It is also known as a Ring Buffer. Why we use circular queue? ▪ If the rear reaches to the end position of the Queue then there might be possibility that some vacant spaces are left in the beginning which cannot be utilized. ▪ So, to overcome such limitations, the concept of the circular queue was introduced. ▪ There is one solution to avoid such wastage of memory space by shifting both the elements at the left and adjust the front and rear end accordingly. ▪ It is not a practically good approach because shifting all the elements will consume lots of time. ▪ The efficient approach to avoid the wastage of the memory is to use the circular queue data structure. 14. Implement circular queue using one example. Insert 5,Insert 10,Insert 15,Insert 20,Insert 25,Insert 30,Delete,Delete,Insert 35,Insert 40 15. What is link list? Explain Insertion of Link list with example. A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. ▪ Linked List can be defined as collection of objects called nodes that are randomly stored in the memory. ▪ A node contains two fields i.e. data stored at that particular address and the pointer which contains the address of the next node in the memory. ▪ The last node of the list contains pointer to the null. Insertion in Singly link list :- ▪ The insertion into a singly linked list can be performed at different positions. ▪ Based on the position of the new node being inserted, the insertion is categorized into the following categories:- 1.Insertion at beginning of the list 2.Insertion at end of the list 3.Insertion after specified node Insertion at beginning of the list : Steps:- ➢Allocate memory for new node ➢Store data ➢Change next of new node to point to head ➢Change head to point to recently created node Insertion at end of the list : Steps:- ➢Allocate memory for new node ➢Store data ➢Traverse to last node ➢Change next of last node to recently created node Insert at the Middle ➢Allocate memory and store data for new node ➢Traverse to node just before the required position of new node ➢Change next pointers to include new node in between Unit :4 16. Define Tree Explain Binary Tree in Detail. Ans:- Trees represent a special case of more general structures known as graphs. In a graph, there is no restrictions on the number of links that can enter or leave a node, and cycles may be present in the graph. The figure 5.1.1 shows a tree and a non-tree. In a tree data structure, there is no distinction between the various children of a node i.e., none is the "first child" or "last child". A tree in which such distinctions are made is called an ordered tree, and data structures built on them are called ordered tree data structures. Ordered trees are by far the commonest form of tree data structure. BINARY TREE: In general, tree nodes can have any number of children. In a binary tree, each node can have at most two children. A binary tree is either empty or consists of a node called the root together with two binary trees called the left subtree and the right subtree. A tree with no nodes is called as a null tree. A binary tree is shown in figure 5.2.1. Binary trees are easy to implement because they have a small, fixed number of child links. Because of this characteristic, binary trees are the most common types of trees and form the basis of many important data structures. 17. Explain In order and Pre-order Traversal. Inorder Traversal: In the case of inorder traversal, the root of each subtree is visited after its left subtree has been traversed but before the traversal of its right subtree begins. The steps for traversing a binary tree in inorder traversal are: 1. Visit the left subtree, using inorder. 2. Visit the root. 3. Visit the right subtree, using inorder. The algorithm for inorder traversal is as follows: void in order(node *root) { if(root != NULL) { in order(root->lchild); Print root -> data; inorder(root->rchild); } } Preorder Traversal: In a preorder traversal, each root node is visited before its left and right subtrees are traversed. Preorder search is also called backtracking. The steps for traversing a binarytree in preorder traversal are: 1. Visittheroot. 2. Visittheleftsubtree, usingpreorder. 3. Visittherightsubtree, usingpreorder. The algorithm for preorder traversal is as follows:void preorder(node *root) { if( root != NULL ) { print root -> data; preorder (root -> lchild);preorder (root -> rchild); } } 18. Convert a Following Tree into in-order and pre-order Traverse. Traverse the following binary tree in pre, post, inorder and level order. 19. Explain Depth first search in Detail. In Depth first search, we begin with root as a start state, then some successor of the start state, then some successor of that state, then some successor of that and so on, trying to reach a goal state. One simple way to implement depth first search is to use astack data structure consisting of root node as a start state. If depth first search reaches a state S without successors, or if all the successors of a state S have been chosen (visited) and a goal state has not get been found, then it “backs up” that means it goes to the immediately previous state or predecessor formally, the state whose successor was ‘S’ originally. To illustrate this let us consider the tree shown below. Suppose S is the start and G is the only goal state. Depth first search will first visit S, then A, then D. But D has no successors, so we must back up to A and try its second successor, E. But this doesn’t have any successors either, so we back up to A again. But now we have tried all the successors of A and haven’t found the goal state G so we must back to ‘S’. Now ‘S’ has a second successor, B. But B has no successors, so we back up to S again and choose its third successor, C. C has one successor, F. The first successor of F is H, and the first of H is J. J doesn’t have any successors, so we back upto H and try its second successor. And that’s G, the only goal state. So the solution path to the goal is S, C, F, H and G and the states considered were in order S, A, D, E, B, C, F, H, J, G. Disadvantages: 1. It works very fine when search graphs are trees or lattices, but can get struck in an infinite loop on graphs. This is because depth first search can travel around a cycle in the graph forever. To eliminate this keep a list of states previously visited, and never permit search to return to any of them. 2. We cannot come up with shortest solution to the problem. 20. Explain Breadth first search in Detail. BFS stands for Breadth First Search. It is also known as level order traversal. The Queue data structure is used for the Breadth First Search traversal. When we use the BFS algorithm for the traversal in a graph, we can consider any node as a root node. Let's consider the below graph for the breadth first search traversal. Suppose we consider node 0 as a root node. Therefore, the traversing would be started from node 0. Once node 0 is removed from the Queue, it gets printed and marked as a visited node. Once node 0 gets removed from the Queue, then the adjacent nodes of node 0 would be inserted in a Queue as shown below: Now the node 1 will be removed from the Queue; it gets printed and marked as a visited node Once node 1 gets removed from the Queue, then all the adjacent nodes of a node 1 will be added in a Queue. The adjacent nodes of node 1 are 0, 3, 2, 6, and 5. But we have to insert only unvisited nodes in a Queue. Since nodes 3, 2, 6, and 5 are unvisited; therefore, these nodes will be added in a Queue as shown below: The next node is 3 in a Queue. So, node 3 will be removed from the Queue, it gets printed and marked as visited as shown below: Once node 3 gets removed from the Queue, then all the adjacent nodes of node 3 except the visited nodes will be added in a Queue. The adjacent nodes of node 3 are 0, 1, 2, and 4. Since nodes 0, 1 are already visited, and node 2 is present in a Queue; therefore, we need to insert only node 4 in a Queue. Now, the next node in the Queue is 2. So, 2 would be deleted from the Queue. It gets printed and marked as visited as shown below: Once node 2 gets removed from the Queue, then all the adjacent nodes of node 2 except the visited nodes will be added in a Queue. The adjacent nodes of node 2 are 1, 3, 5, 6, and 4. Since the nodes 1 and 3 have already been visited, and 4, 5, 6 are already added in the Queue; therefore, we do not need to insert any node in the Queue. The next element is 5. So, 5 would be deleted from the Queue. It gets printed and marked as visited as shown below: Once node 5 gets removed from the Queue, then all the adjacent nodes of node 5 except the visited nodes will be added in the Queue. The adjacent nodes of node 5 are 1 and 2. Since both the nodes have already been visited; therefore, there is no vertex to be inserted in a Queue. The next node is 6. So, 6 would be deleted from the Queue. It gets printed and marked as visited as shown below: Once the node 6 gets removed from the Queue, then all the adjacent nodes of node 6 except the visited nodes will be added in the Queue. The adjacent nodes of node 6 are 1 and 4. Since the node 1 has already been visited and node 4 is already added in the Queue; therefore, there is not vertex to be inserted in the Queue. The next element in the Queue is 4. So, 4 would be deleted from the Queue. It gets printed and marked as visited. Once the node 4 gets removed from the Queue, then all the adjacent nodes of node 4 except the visited nodes will be added in the Queue. The adjacent nodes of node 4 are 3, 2, and 6. Since all the adjacent nodes have already been visited; so, there is no vertex to be inserted in the Queue. Unit:5 21. What is hashing explain with example: Hashing is an important data structure designed to solve the problem of efficiently finding and storing data in an array. For example, if you have a list of 20000 numbers, and you have given a number to search in that list- you will scan each number in the list until you find a match. It requires a significant amount of your time to search in the entire list and locate that specific number. This manual process of scanning is not only time consuming but inefficient too. With hashing in the data structure, you can narrow down the search and find the number within seconds. Hashing in a data structure is a two-step process. 1. The hash function converts the item into a small integer or hash value. This integer is used as an index to store the original data. 2. It stores the data in a hash table. You can use a hash key to locate data quickly. Examples of Hashing in Data Structure: The following are real-life examples of hashing – 👉In schools, the teacher assigns a unique roll number to each student. Later, the teacher uses that roll number to retrieve information about that student. 👉A library has an infinite number of books. The librarian assigns a unique number to each book. This unique number helps in identifying the position of the books on the bookshelf. 22. What is Hash Function? The hash function in a data structure maps arbitrary size of data to fixed-sized data. It returns the following values: a small integer value (also known as hash value), hash codes, and hash sums. hash = hashfunc(key) index = hash % array size The has function must satisfy the following requirements: 👉 A good hash function is easy to compute. 👉 A good hash function never gets stuck in clustering and distributes keys evenly across the hash table. 👉 A good hash function avoids collision when two elements or items get assigned to the same hash value. 23. Collision Resolution Techniques: Hashing falls into a collision if two keys are assigned the same index number in the hash table. The collision creates a problem because each index in a hash table is supposed to store only one value. Hashing in data structure uses several collision resolution techniques to manage the performance of a hash table. 24.What is linear probing: Hashing results in an array index that is already occupied to store a value. In such a case, hashing performs a search operation and probes linearly for the next empty cell. Linear Probing Example Imagine you have been asked to store some items inside a hash table of size 30. The items are already sorted in a key-value pair format. The values given are: (3,21) (1,72) (63,36) (5,30) (11,44) (15,33) (18,12) (16,80) (46,99). The hash(n) is the index computed using a hash function and T is the table size. If slot index = ( hash(n) % T) is full, then we look for the next slot index by adding 1 ((hash(n) + 1) % T). If (hash(n) + 1) % T is also full, then we try (hash(n) + 2) % T. If (hash(n) + 2) % T is also full, then we try (hash(n) + 3) % T. The hash table will look like the following: 25. Explain Advantages and disadvantages of hashing: Advantages : 👉 Main advantage is synchronization. 👉 In many situations, hash tables turn out to be more efficient than search trees or any other table lookup structure. For this reason, they are widely used in many kinds of computer software’s, particularly for associative arrays, database indexing, caches and sets. Disadvantages : 👉Hash collisions are practically unavoidable. when hashing a random subset of a large set of possible keys. 👉 Hash tables become quite inefficient when there are many collisions. 👉 Hash table does not allow null values, like hash map. Unit 6 26.Explain sorting in detail: ● Sorting is the process of arranging the elements of an array so that they can be placed either in ascending or descending order. ● For example, consider an array A = {A1, A2, A3, A4, …., An }, the array is called to be in ascending order if element of A are arranged like A1 > A2 > A3 > A4 > A5 > ? > An Consider an array; int A[10] = { 5, 4, 10, 2, 30, 45, 34, 14, 18, 9 } ● The Array sorted in ascending order will be given as:- A[] = { 2, 4, 5, 9, 10, 14, 18, 30, 34, 45 } 45,34,30,18,14,10,9,5,4,2 ● There are many techniques by using which, sorting can be performed. 1. Bubble Sort 2. Bucket Sort 3. Comb Sort 4. Counting Sort 5. Heap Sort 6. Insertion Sort 7. Merge Sort 8. Quick Sort 9. Radix Sort 10. Selection Sort 11. Shell Sort 27.Explain Bubble sort with algorithm : In Bubble sort, Each element of the array is compared with its adjacent element. ● The algorithm processes the list in passes. A list with n elements requires n-1 passes for sorting. ● Consider an array A of n elements whose elements are to be sorted by using Bubble sort. The algorithm processes like following:- ● In Pass 1, A[0] is compared with A[1], A[1] is compared with A[2], A[2] is compared with A[3] and so on. At the end of pass 1, the largest element of the list is placed at the highest index of the list. ● In Pass 2, A[0] is compared with A[1], A[1] is compared with A[2] and so on. At the end of Pass 2 the second largest element of the list is placed at the second highest index of the list. ● In pass n-1, A[0] is compared with A[1], A[1] is compared with A[2] and so on. At the end of this pass. The smallest element of the list is placed at the first index of the list. Algorithm : Step 1: Repeat Step 2 For i = 0 to N-1 Step 2: Repeat For J = i + 1 to N - I Step 3: IF A[J] > A[i] SWAP A[J] and A[i] [END OF INNER LOOP] [END OF OUTER LOOP Step 4: EXIT Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Bubble sort, also referred to as comparison sort, is a simple sorting algorithm that repeatedly goes through the list, compares adjacent elements and swaps them if they are in the wrong order. This is the most simplest algorithm and inefficient at the same time. Yet, it is very much necessary to learn about it as it represents the basic foundations of sorting. 28.Explain selection sort in detail: In selection sort, the smallest value among the unsorted elements of the array is selected in every pass and inserted to its appropriate position into the array. First, find the smallest element of the array and place it on the first position. Then, find the second smallest element of the array and place it on the second position. The process continues until we get the sorted array. The array with n elements is sorted by using n-1 pass of selection sort algorithm. The idea behind this algorithm is pretty simple. We divide the array into two parts: sorted and unsorted. The left part is sorted subarray and the right part is unsorted subarray. Initially, sorted subarray is empty and unsorted array is the complete given array. We perform the steps given below until the unsorted subarray becomes empty: Pick the minimum element from the unsorted subarray. Swap it with the leftmost element of the unsorted subarray. Now the leftmost element of unsorted subarray becomes a part (rightmost) of sorted subarray and will not be a part of unsorted subarray. A selection sort works as follows: Part of unsorted array Part of sorted array Leftmost element in unsorted array Minimum element in unsorted array This is our initial array A = [5, 2, 6, 7, 2, 1, 0, 3] Leftmost element of unsorted part = A[0] Minimum element of unsorted part = A[6] We will swap A[0] and A[6] then, make A[0] part of sorted subarray. Leftmost element of unsorted part = A[1] Minimum element of unsorted part = A[5] We will swap A[1] and A[5] then, make A[1] part of sorted subarray. Leftmost element of unsorted part = A[2] Minimum element of unsorted part = A[4] We will swap A[2] and A[4] then, make A[2] part of sorted subarray. Leftmost element of unsorted part = A[3] Minimum element of unsorted part = A[5] We will swap A[3] and A[5] then, make A[3] part of sorted subarray. Leftmost element of unsorted part = A[4] Minimum element of unsorted part = A[7] We will swap A[4] and A[7] then, make A[4] part of sorted subarray. Leftmost element of unsorted part = A[5] Minimum element of unsorted part = A[6] We will swap A[5] and A[6] then, make A[5] part of sorted subarray. Leftmost element of unsorted part = A[6] Minimum element of unsorted part = A[7] We will swap A[6] and A[7] then, make A[6] part of sorted subarray. 29.Explain insertion sort with first Iteration: Insertion sort is the sorting mechanism where the sorted array is built having one item at a time. The array elements are compared with each other sequentially and then arranged simultaneously in some particular order. The analogy can be understood from the style we arrange a deck of cards. This sort works on the principle of inserting an element at a particular position, hence the name Insertion Sort. Insertion Sort works as follows: The first step involves the comparison of the element in question with its adjacent element. And if at every comparison reveals that the element in question can be inserted at a particular position, then space is created for it by shifting the other elements one position to the right and inserting the element at the suitable position. The above procedure is repeated until all the element in the array is at their apt position. let us now understand working with the following example: Consider the following array: 25, 17, 31, 13, 2 First Iteration: Compare 25 with 17. The comparison shows 17< 25. Hence swap 17 and 25. The array now looks like: 17, 25, 31, 13, 2 30.Explain searching and one of its method in detail. Searching in data structure refers to the process of finding the required information from a collection of items stored as elements in the computer memory. These sets of items are in different forms, such as an array, linked list, graph, or tree. Another way to define searching in the data structures is by locating the desired element of specific characteristics in a collection of items. There are different kind of searching method here we discuss about linear search…. Linear Search The linear search algorithm iteratively searches all elements of the array. It has the best execution time of one and the worst execution time of n, where n is the total number of items in the search array. It is the simplest search algorithm in data structure and checks each item in the set of elements until it matches the searched element till the end of data collection. When the given data is unsorted, a linear search algorithm is preferred over other search algorithms. Complexities in linear search are given below: Space Complexity: Since linear search uses no extra space, its space complexity is O(n), where n is the number of elements in an array. Time Complexity: ● Best-case complexity = O(1) occurs when the searched item is present at the first element in the search array. ● Worst-case complexity = O(n) occurs when the required element is at the tail of the array or not present at all. ● Average- case complexity = average case occurs when the item to be searched is in somewhere middle of the Array. Pseudocode for the linear search algorithm procedure linear_search (list, value) for each item in the list if match item == value return the item's location end if end for end procedure Example, Let’s take the following array of elements: 45, 78, 15, 67, 08, 29, 39, 40, 12, 99 To find ‘29’ in an array of 10 elements given above, as we know linear search algorithm

  • Data Structure U-1 (BCA sem-ii)

    Data Structure UNIT – 1 Introduction To Data Structure What Is Data Structure Data Structure is a way to store and organize data so that it can be used efficiently. Some examples of Data Structures are Arrays, Linked List, Stack , Queue etc… T yp • There are two types of data structures: 1.Primitive data structure 2. Non-primitive data structure Primitive data structure Non primitive data structure 1) Primitive data structure is a kind of 1) Non-primitive data structure is adata structure that stores the data type of data structure that can of only one type. Store the data of more than one type. 2) Example of primitive data structure 2) Example of non- primitive dataare integer , character , float , etc.. Structures are Array , Linked list, Stack, Queue. 3) It Starts with a lowercase character 3) It Starts with an uppercasecharacter. 4) Primitive data structure will contain 4) Non primitive data structure cansome value.(it can’t be null) consist of a null value. 5) Size depends on the type of the 5) In case of non-primitive dataData structure. Structure size is not fixed. ❖ . Non-Primitive Data structure The non-primitive data structure is divided into two types: 1. Linear data structure 2. Non-linear data structure Linear data structure Non-Linear data structure 1) In a Linear data structure , data 1) In a Non-Linear data structure ,elements are arranged in a linear data elements are not in a (sequence) order. Sequence(non – ordered list) 2) Each and every elements are 2) Data elements are attached inattached to its previous and next hierarchically manner. adjacent. 3) In a linear data structure single 3) in non- linear data structure levelis involved. Multiple levels are involved. 4) It is easy to implementation. 4) it is complex to implementation. 5) Example: Array, Linked list, stack 5) Example : tree , graphqueue • Linear Data structure is divided into two types: • Static data structure: It is a type of data structure where the size is allocated at the compile time. Therefore, the maximum size is fixed. • Dynamic data structure: It is a type of data structure where the size is allocated at the run time. Therefore, the maximum size is flexible. Major Operations Of Data Structure The major or the common operations that can be performed on the data structures are: • Searching: We can search for any element in a data structure. • Sorting: We can sort the elements of a data structure either in an ascending or descending order. • Insertion: We can also insert the new element in a data structure. • Updation: We can also update the element, i.e., we can replace the element with another element. • Deletion: We can also perform the delete operation to remove the element from the data structure. Advantages Of Data Structure • Data structure helps in efficient storage of data in the storage device. • Data structure usage provides convenience while retrieving the data from storage device. • Data structure provides effective and efficient processing of small as well as large amount of data. • Usage of proper data structure, can help programmer save lots of time or processing time while operations such as storage, retrieval or processing of data. • Manipulation of large amount of data can be carried out easily with the use of good data structure approach. • Most of the well organized data structures like Array, stack, queues, graph, tree, linked list has well built and pre-planned approach for operations like storage, addition, retrieval, manipulation, deletion, etc. While using them, programmer can be completely rely on these data structures. • Data structure usage can simply encourage reusability in long run as well. Performance analysis and measurement • Performance analysis helps us to select the best algorithm from multiple algorithm to solve a problem. • When there are multiple alternative algorithms to solve a problem , we analyze them and pick the one which is best suitable for our requirements. Definition : • Performance of an algorithm is a process of making evaluative judgements about algorithms. Generally the performance of an algorithm depends on the following elements.. • Whether that algorithm is providing the exact solution for the problem? • Whether it is easy to understand? • Whether it is easy to implement? • How much space(memory) it requires to solve the problem? • How much time it takes to solve the problem? Algorithm • An algorithm is a process or a set of rules required to perform calculations or some other problem-solving operations especially by a computer. • The formal definition of an algorithm is that it contains the finite set of instructions which are being carried in a specific order to perform the specific task. • It is not the complete program or code. • It is just a solution (logic) of a problem, which can be represented either as an informal description using a Flowchart or Pseudocode. Characteristics of an Algorithm • The following are the characteristics of an algorithm: • Input: An algorithm has some input values. We can pass 0 or some input value to an algorithm. • Output: We will get 1 or more output at the end of an algorithm. • Unambiguity: An algorithm should be unambiguous which means that the instructions in an algorithm should be clear and simple. • Finiteness: An algorithm should have finiteness. Here, finiteness means that the algorithm should contain a limited number of instructions, i.e., the instructions should be countable. • Effectiveness: An algorithm should be effective as each instruction in an algorithm affects the overall process. • Language independent: An algorithm must be language- independent so that the instructions in an algorithm can be implemented in any of the languages with the same output. Dataflow of an Algorithm • Problem: A problem can be a real-world problem or any instance from the real-world problem for which we need to create a program or the set of instructions. The set of instructions is known as an algorithm. • Algorithm: An algorithm will be designed for a problem which is a step by step procedure. • Input: After designing an algorithm, the required and the desired inputs are provided to the algorithm. • Processing unit: The input will be given to the processing unit, and the processing unit will produce the desired output. • Output: The output is the outcome or the result of the program. We need algorithms because of the following reasons:- • Scalability: It helps us to understand the scalability. When we have a big real-world problem, we need to scale it down into small small steps to easily analyze the problem. • Performance: The real-world is not easily broken down into smaller steps. If the problem can be easily broken into smaller steps means that the problem is feasible. Example Of Algorithm • The following are the steps required to add two numbers entered by the user: • Step 1: Start • Step 2: Declare three variables a, b, and sum. • Step 3: Enter the values of a and b. • Step 4: Add the values of a and b and store the result in the sum variable, i.e., sum=a+b. • Step 5: Print sum • Step 6: Stop Factors of an Algorithm • The following are the factors that we need to consider for designing an algorithm: • Modularity: If any problem is given and we can break that problem into small-small modules or small-small steps, which is a basic definition of an algorithm, it means that this feature has been perfectly designed for the algorithm. • Correctness: The correctness of an algorithm is defined as when the given inputs produce the desired output, which means that the algorithm has been designed algorithm. The analysis of an algorithm has been done correctly. • Maintainability: Here, maintainability means that the algorithm should be designed in a very simple structured way so that when we redefine the algorithm, no major change will be done in the algorithm. • Functionality: It considers various logical steps to solve the real-world problem. • Robustness: Robustness means that how an algorithm can clearly define our problem. • User-friendly: If the algorithm is not user friendly, then the designer will not be able to explain it to the programmer. • Simplicity: If the algorithm is simple then it is easy to understand. • Extensibility: If any other algorithm designer or programmer wants to use your algorithm then it should be extensible. Algorithm Analysis Analysis of efficiency of an algorithm can be performed at two different stages, before implementation and after implementation, as • A priori analysis − This is defined as theoretical analysis of an algorithm. Efficiency of algorithm is measured by assuming that all other factors e.g. speed of processor, are constant and have no effect on implementation. • A posterior analysis − This is defined as empirical analysis of an algorithm. The chosen algorithm is implemented using programming language. Next the chosen algorithm is executed on target computer machine. In this analysis, actual statistics like running time and space needed are collected. • Algorithm analysis is dealt with the execution or running time of various operations involved. Running time of an operation can be defined as number of computer instructions executed per operation. • Algorithm Complexity • Suppose X is treated as an algorithm and N is treated as the size of input data, the time and space implemented by the Algorithm X are the two main factors which determine the efficiency of X. • Time Factor − The time is calculated or measured by counting the number of key operations such as comparisons in sorting algorithm. • Space Factor − The space is calculated or measured by counting the maximum memory space required by the algorithm. • The complexity of an algorithm f(N) provides the running time and / or storage space needed by the algorithm with respect of N as the size of input data. • Space Complexity • Space complexity of an algorithm represents the amount of memory space needed the algorithm in its life cycle. • Space needed by an algorithm is equal to the sum of the following two components:- -> Fixed part -> Variable part • A fixed part that is a space required to store certain data and variables (i.e. simple variables and constants, program size etc.), that are not dependent of the size of the problem. • A variable part is a space required by variables, whose size is totally dependent on the size of the problem. For example, recursion stack space, dynamic memory allocation etc. • Space complexity S(p) of any algorithm p is S(p) = A + Sp(I) Where A is treated as the fixed part and S(I) is treated as the variable part of the algorithm which depends on instance characteristic I. Following is a simple example that tries to explain the concept • Algorithm • SUM(P, Q) • Step 1 - START • Step 2 - R ← P + Q + 10 • Step 3 – Stop • Here we have three variables P, Q and R and one constant. Hence S(p) = 1+3. Now space is dependent on data types of given constant types and variables and it will be multiplied accordingly. • Time Complexity • Time Complexity of an algorithm is the representation of the amount of time required by the algorithm to execute to completion. Time requirements can be denoted or defined as a numerical function t(N), where t(N) can be measured as the number of steps, provided each step takes constant time. • For example, in case of addition of two n-bit integers, N steps are taken. Consequently, the total computational time is t(N) = c*n, where c is the time consumed for addition of two bits. Here, we observe that t(N) grows linearly as input size increases. Asymptotic Analysis Of Algorithm • Asymptotic analysis of an algorithm refers to defining the mathematical framing of its run time performance. • Using asymptotic analysis, we can very well conclude the best case, average case, and worst case scenario of an algorithm. • Usually, the time required by an algorithm falls under three types − • Best Case − Minimum time required for program execution. • Average Case − Average time required for program execution. • Worst Case − Maximum time required for program execution. • Asymptotic Notations Following are the commonly used asymptotic notations to calculate the running time complexity of an algorithm. 1. Ο Notation 2. Ω Notation 3. θ Notation 1. Big Oh Notation, Ο • The notation Ο(n) is the formal way to express the upper bound of an algorithm's running time. It measures the worst case time complexity or the longest amount of time an algorithm can possibly take to complete. 2.Omega Notation, Ω • The notation Ω(n) is the formal way to express the lower bound of an algorithm's running time. It measures the best case time complexity or the best amount of time an algorithm can possibly take to complete. 3. Theta Notation, θ • The notation θ(n) is the formal way to express both the lower bound and the upper bound of an algorithm's running time. It is represented as follows .

bottom of page