diff --git a/SHRESHTHA GUPTA/BigData-1.txt b/SHRESHTHA GUPTA/BigData-1.txt new file mode 100644 index 0000000..9430bc8 --- /dev/null +++ b/SHRESHTHA GUPTA/BigData-1.txt @@ -0,0 +1,39 @@ +Q1.Difference between Hadoop 1 and Hadoop 2? +Ans. +In Hadoop 1 ,there is a single NameNode which is thus the single point of failure whereas, in Hadoop 2.x, +there are Active and Passive NameNodes. In case, the active NameNode fails, the passive NameNode replaces the active NameNode and takes the charge. As a result, high availability is there +in Hadoop 2.x. + +In Hadoop 2 , the YARN provides a central resource manager that share a common resource to run multiple applications +in Hadoop whereas data processing is a problem in Hadoop 1.x. +Hadoop 1 is supported only by Linux +Hadoop 2 is supported by both Linux and Windows. + +Q2.In hadoop 2 why the block size has been set to 128 mb? +Ans. +In Hadoop, input data files are divided into blocks of a prticular size(128 mb by default) and then these blocks of +data are stored on different data nodes. + +Hadoop is designed to process large volumes of data. Each block’s information(its address ie on which data node it +is stored) is placed in namenode. So if the block size is too small, then there will be a large no. of blocks to be +stored on data nodes as well as a large amount of metadata information needs to be stored on namenode, Also each +block of data is processed by a Mapper task. If there are large no. of small blocks, a lot of mapper tasks will be +required. So having small block size is not very efficient. + +Also the block size should not be very large such that , parallelism cant be achieved. It should not be such that +the system is waiting a very long time for one unit of data processing to finish its work. + +A balance needs to be maintained. That’s why the default block size is 128 MB. It can be changed as well depending +on the size of input files. + +Q3.Why name node is relay on memory rather than datanode? +Ans. +Name Node only store metadata which is related to the different blocks and because of this reason it needs high +memory space. Data Nodes don’t need large memory space. + +Q4. Suppose you have 10 PB of data. Metadata is actually store object of file and folder ----> each obj 200 B. +How much min Namenode RAM memory you need for your data node in a cluster to manage the metadata? +Estimate minimum Namenode RAM size for HDFS with 10 PB capacity, block size 64 MB, average metadata size for each +block is 200 B, replication factor is 3. +Ans. +10 PB/(64MB *3) *200B = (10 * 10^15)/(64* 10^6 * 3)*200 B = 10^10/(64*3)* 300B = 1.5625e10 B diff --git a/SHRESHTHA GUPTA/Python_task.txt b/SHRESHTHA GUPTA/Python_task.txt new file mode 100644 index 0000000..847cb0a --- /dev/null +++ b/SHRESHTHA GUPTA/Python_task.txt @@ -0,0 +1,20 @@ +PYTHON EXCITING TASK: +Q.you have to get input from the users and it is recommended to be in voice command and you need to do a +sentimental analysis of the given input[ hint: use textblob library ]. + +Ans. +import speech_recognition as sr +recognizer=sr.Recognizer() +with sr.Microphone() as source: + print('Talk to convert speech to text') + speech=recognizer.listen(source) + print('End of speech') + +try: + print("Text to speech:"+recognizer.recognize_google(speech)) +except: + pass; +from textblob import TextBlob +blob=TextBlob(" "+recognizer.recognize_google(speech)) +blob.sentiment + diff --git a/SHRESHTHA GUPTA/Talend Assignments/Aggregate.png b/SHRESHTHA GUPTA/Talend Assignments/Aggregate.png new file mode 100644 index 0000000..fefe613 Binary files /dev/null and b/SHRESHTHA GUPTA/Talend Assignments/Aggregate.png differ diff --git a/SHRESHTHA GUPTA/Talend Assignments/Filter_rows.png b/SHRESHTHA GUPTA/Talend Assignments/Filter_rows.png new file mode 100644 index 0000000..6684d75 Binary files /dev/null and b/SHRESHTHA GUPTA/Talend Assignments/Filter_rows.png differ diff --git a/SHRESHTHA GUPTA/Talend Assignments/Find_and_replace.png b/SHRESHTHA GUPTA/Talend Assignments/Find_and_replace.png new file mode 100644 index 0000000..57d6e8c Binary files /dev/null and b/SHRESHTHA GUPTA/Talend Assignments/Find_and_replace.png differ diff --git a/SHRESHTHA GUPTA/Talend Assignments/csv_to_xml.png b/SHRESHTHA GUPTA/Talend Assignments/csv_to_xml.png new file mode 100644 index 0000000..3a01a73 Binary files /dev/null and b/SHRESHTHA GUPTA/Talend Assignments/csv_to_xml.png differ diff --git a/SHRESHTHA GUPTA/linux-1.txt b/SHRESHTHA GUPTA/linux-1.txt new file mode 100644 index 0000000..15615f2 --- /dev/null +++ b/SHRESHTHA GUPTA/linux-1.txt @@ -0,0 +1,17 @@ +ASSIGNMENT-1 + +Q1. When we create a user, some hidden files are generated in the directory of the same user at that time. How is it done ? +Ans. +Most commonly, hidden files and directories in the home directory contain settings or data that’s accessed by that user’s programs. They’re not intended to be edited by the user, only the application. That’s why they’re hidden from the user’s normal view. + The hidden files in our Linux home directory are used to store user settings. This includes settings for command-line utilities as well as GUI-based applications. Removing them will remove user settings. Typically, it won’t cause a program to break. +If we run ls -la on our home directory, we will discover a pile of hidden files and directories with dot prefixes. + +Q2. - Make sub directories inside a parent directory by using single mkdir command. +Ans. +When we want to create sub-directories , we will need to use – p parameter. This parameter will create parent directory first, if mkdir cannot find it. Let say we want to create directory named 'letter and directory named 'important' under directory letter. Then the syntax will be like this: +mkdir – p letter/important + + + +SUBMITTED BY: +SHRESHTHA GUPTA diff --git a/SHRESHTHA GUPTA/linux-2.txt b/SHRESHTHA GUPTA/linux-2.txt new file mode 100644 index 0000000..ff44aa7 --- /dev/null +++ b/SHRESHTHA GUPTA/linux-2.txt @@ -0,0 +1,55 @@ +ASSIGNMENT-2 +LINUX +1) How to change the Umask value for any user permanently? +Ans. +vim /home/username/.bashrc then type umask 024(eg) save and quit then vim /home/username/.bash_profile then type again umask 024(eg) save and quit then su user and check umask value if you exit terminal and open again and check umask the value is 024. + +2) How to add a new user without using adduser & useradd command? +Ans. +• Add an entry for the user in /etc/passwd file. +• Add an entry for the group in /etc/group file. +• Create the home directory for the added user. +• Set the new user password using the passwd command. + +• /etc/skel directory contains all the defaults files which are present inside the home folder of any user. + +So, Now,copy the contents from /etc/skel inside /home/user. + +3) Can we change the Umask value to 0888. +If yes, then how. If no then why ? +Ans. No we cannot change the Umask value to 0888 because the maximum umask value itself if 777. + +4)How to add a new user with a Unique user id (e.g 1345) & check out the unique Id of that user? +Ans. +We can use the -u option to create a user with a specific Unique User Id. +For example , to create a new user named username with UID of 1345 we would type +Sudo useradd -u 1345 username +We can also verify the user’s UID, using the id command. +id -u username +It will display the output as 1345. + +5) How to change the group of any folder? +5(a) After this checkout the group name of the files present in that folder? +Ans. +Sudo chgrp groupname filename + Where groupname is name of the new group or the group ID (GID) + And filename is name of one or more files. + To find out to which group the files present in the folder belongs to , We can use the ls -l command. + +5(b) Try to change the group of the folder & the files present in the same folder using a single command. + +Ans. We can use the -R option then. + Sudo chgrp -R groupname filename + + + +SUBMITTED BY:- +SHRESHTHA GUPTA + + + + + + + + diff --git a/SHRESHTHA GUPTA/linux-3.txt b/SHRESHTHA GUPTA/linux-3.txt new file mode 100644 index 0000000..e61a4c2 --- /dev/null +++ b/SHRESHTHA GUPTA/linux-3.txt @@ -0,0 +1,34 @@ +ASSIGNMENT-3(LINUX) + +Q1.Create and compress the file with bzip2. +Ans.To create a file: +Touch filename.txt +We can compress a file as below, where the flag -z enables file compression: +bzip2 filename +OR +bzip2 -z filename +Q2.What would be the argument to be given to unzip that file? +Ans. sudo apt install unzip +Unzip filename +Q3.Read a file and show the data on terminal using file input and output redirection. +Ans. gedit filename + Cat < filename +Q4. How to change the shell of user to “/bin/sh” at the time of adding the user? +Ans. +Syntax: +useradd -s [shell] [username] +For example: +To set the shell of user testuser to /bin/sh:- +useradd -s /bin/sh testuser + + +SUBMITTED BY: +SHRESHTHA GUPTA + + + + + + + + diff --git a/SHRESHTHA GUPTA/python-1.txt b/SHRESHTHA GUPTA/python-1.txt new file mode 100644 index 0000000..732a615 --- /dev/null +++ b/SHRESHTHA GUPTA/python-1.txt @@ -0,0 +1,31 @@ +PYTHON ASSIGNMENT-1 + +Q1. What is Jpython and Cpython? +Ans +Jython is an implementation of the Python programming language designed to run on the Java platform. The implementation was formerly known as JPython until 1999. +Jython programs can import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules. Jython includes almost all of the modules in the standard Python programming language distribution, lacking only some of the modules implemented originally in C. For example, a user interface in Jython could be written with Swing, AWT or SWT. Jython compiles Python source code to Java bytecode (an intermediate language) either on demand or statically. + +CPython is the reference implementation of the Python programming language. Written in C and Python, CPython is the default and most widely used implementation of the language. +CPython can be defined as both an interpreter and a compiler as it compiles Python code into bytecode before interpreting it. It has a foreign function interface with several languages including C, in which one must explicitly write bindings in a language other than Python. + +Q2.What is the Basic difference between Python2 & python3? +Ans +Python 3 syntax is simpler and easily understandable whereas Python 2 syntax is comparatively difficult to understand. Python 3 default storing of strings is Unicode whereas Python 2 stores need to define Unicode string value with "u." + +Q3.What is the Difference between ASCII & unicode? +Ans +ASCII defines 128 characters, which map to the numbers 0–127. Unicode defines (less than) 221characters, which, similarly, map to numbers 0–221 (though not all numbers are currently assigned, and some are reserved). +Unicode is a superset of ASCII, and the numbers 0–128 have the same meaning in ASCII as they have in Unicode. For example, the number 65 means "Latin capital 'A'". +Because Unicode characters don't generally fit into one 8-bit byte, there are numerous ways of storing Unicode characters in byte sequences, such as UTF-32 and UTF-8. +C follows ASCII and Java follows UNICODE. + + +SUBMITTED BY:- +SHRESHTHA GUPTA + + + + + + + diff --git a/SHRESHTHA GUPTA/python-2.txt b/SHRESHTHA GUPTA/python-2.txt new file mode 100644 index 0000000..a92c305 --- /dev/null +++ b/SHRESHTHA GUPTA/python-2.txt @@ -0,0 +1,44 @@ +PYTHON ASSIGNMENT-2 + +Q1. What should be the output? ( 3 + 4 ** 6 - 9 * 10 / 2 ) +Ans +Output will be : 4054.0 +Q2. Let say I have, some string "hello this side regex" +Find out the count of the total vowels. +vowels - ['a','e','i','o','u'] +Ans. +string ="hello this side regex" +vowel_counts = {} +for vowel in "aeiou": + count = string.count(vowel) + vowel_counts[vowel] = count +print(vowel_counts) + +Output will be: +{'a': 0, 'e': 4, 'i': 2, 'o': 1, 'u': 0} +Q3. Find out the area of triangle. +1/2 * b * h (formula of area) +- You have to take value from user about the base, & the height. +Ans +base=int(input("Enter the base of the triangle")) +height=int(input("Enter the height of the triangle")) +area=base*height/2 +print(area) + + + + + +Q4. Print the calendar on the terminal. If you give the year. +- Allow the user to input the year. +- Then print calendar of that year. +Ans. +Import os +Year=int(input(“Enter the year”)) +os.system(“cal {}”.format(year)) + +Tried the above code in Redhat Terminal and it gave the required output. + + +SUBMITTED BY: +SHRESHTHA GUPTA diff --git a/SHRESHTHA GUPTA/python-3.txt b/SHRESHTHA GUPTA/python-3.txt new file mode 100644 index 0000000..1c7d126 --- /dev/null +++ b/SHRESHTHA GUPTA/python-3.txt @@ -0,0 +1,58 @@ +ASSIGNMENT-3(PYTHON) + +Q1.Find the Armstrong Number between the two numbers which are input by user. + +Ans. +lower = int(input("Enter lower range: ")) +upper = int(input("Enter upper range: ")) + +for num in range(lower,upper + 1): + + sum = 0 + + temp = num + while temp > 0: + digit = temp % 10 + sum += digit ** 3 + temp //= 10 + + if num == sum: + print(num) + +Q2.Let’s say you have a string “hello this world @2020!!! ” +Remove the punctuation like [“@!#$%&*()”] from the string +Final output should be without the punctuation +“hello this world 2020”. + +Ans. + +punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' +str = "hello this world @2020!!!" +new= "" +for char in str: + if char not in punctuations: + new= new + char + +print(new) + +Q3.You have a list with words - [“Apple”, “banana”, “cat”, “REGEX”,”apple”] +Sort words in Alphabetical order. +If you get output, like [Apple, apple, banana] +How has it happened? + +Ans. + +a = ["Apple", "banana", "cat", "REGEX","apple"] + +x = sorted(a , key=str.lower) + +print(x) + +This will give us output: +['Apple', 'apple', 'banana', 'cat', 'REGEX'] +diregarding the capitalization in the list objects by using key function. + + + + + diff --git a/SHRESHTHA GUPTA/python-4.txt b/SHRESHTHA GUPTA/python-4.txt new file mode 100644 index 0000000..3783b08 --- /dev/null +++ b/SHRESHTHA GUPTA/python-4.txt @@ -0,0 +1,93 @@ +PYTHON ASSIGNMENT-4 +Q1.Write a Program to print new list which contains all the first Characters of strings present in a +list. +LIST_STATES = ["GOA","RAJASTHAN","KARNATAKA","GUJRAT","MANIPUR","MADHYA PRADESH"] + +Ans. +LIST_STATES = ["GOA","RAJASTHAN","KARNATAKA","GUJRAT","MANIPUR","MADHYA PRADESH"] +LIST_STATES + +mylist = [] +for i in LIST_STATES: + mylist.append(i[0]) +print(mylist) + +Q2.Write a program to replace each string with an integer value in a given list of strings. +The replacement integer value should be a sum of AScci values of each character of type +corresponding string. +LIST: ['Ganga', 'Tapti', 'Kaveri', 'Yamuna', 'Narmada' ] + +Ans. +list=['Ganga', 'Tapti', 'Kaveri', 'Yamuna', 'Narmada' ] +new=[] +for i in range(0,len(list)): + j=0 + sum=0 + while(j20): + list1.append(i) +print(list1) + + +2.REGex=[1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12] +list2=[] + +for i in REGex: + if(i<=10): + list2.append(i) +print(list2) + diff --git a/SHRESHTHA GUPTA/python-5.txt b/SHRESHTHA GUPTA/python-5.txt new file mode 100644 index 0000000..714c330 --- /dev/null +++ b/SHRESHTHA GUPTA/python-5.txt @@ -0,0 +1,84 @@ +PYTHON ASSIGNMENT-5 + +Q1.Hint: +-> Make a use of Time Module and for Loop. +-> Output Should be : +Loading. +Loading.. +Loading... +Loading.... +Loading..... +Here it shows you 5 output but you have to print only "Loading....." in animated +form. + +Ans. + +import time +for i in range(10): + time.sleep(1) + print("Loading....") + + +Q2.Difference between yield and return? +Ans.The yield statement suspends function’s execution and sends a value back to the caller, but retains enough state +to enable function to resume where it is left off.When resumed, the function continues execution immediately after +the last yield run.This allows its code to produce a series of values over time, rather than computing them at +once and sending them back like a list. + +Return sends a specified value back to its caller whereas Yield can produce a sequence of values. We should use +yield when we want to iterate over a sequence, but don’t want to store the entire sequence in memory. + + +Q3.Make digital Clock and run it for 5 sec. +Output: +16:39:08 + :09 + :10 + :11 + :12 + +Ans. +import time +for i in range(5): + time.sleep(1) + current_time = time.ctime() + time_format = current_time[11:19] + print(time_format) + + +Q4.Add anything in tuple.example: (1,2,3,4) -> new tuple (1,2,3,4,5) + +Ans. +my_tuple = (1,2,3,4) +my_list = list(my_tuple) +my_list.append(5) +my_tuple = tuple(my_list) +print(my_tuple) + +Q5.WhatsApp texting using webbrowser Lib. + +Ans. +import webbrowser +import time +import datetime + +name = input('Enter the contact number of a person you want to send message in WhatsApp: ') +message = input('Enter the message: ') +time1 = input('Enter time in {hh:mm:ss} format: ') +print(f'Time entered by user: {time1}') +while True: + current_time = time.ctime() + time_format = current_time[11:19] + time.sleep(1) + print(f'Current time: {time_format}') + if time1 == time_format: + webbrowser.open_new_tab(f'https://web.whatsapp.com/send?phone=+91{name}&text={message}') + print(message) + break + elif time1 < time_format: + print('Enter correct time') + break + else: + print('waiting..') + + diff --git a/SHRESHTHA GUPTA/python-6.txt b/SHRESHTHA GUPTA/python-6.txt new file mode 100644 index 0000000..4e1445f --- /dev/null +++ b/SHRESHTHA GUPTA/python-6.txt @@ -0,0 +1,92 @@ +PYTHON ASSIGNMENT-6 + +Q1.Write a Python program to read a file line by line and store it into a list. + +Ans. +def file_read(fname): + with open (fname, "r") as myfile: + data=myfile.readlines() + print(data) +file_read(r'C:\Users\shreshtha\Desktop\abc.txt') + +Q2.Write a Python program to read a file line by line and store it into an array. + +Ans. +def file_read(fname): + content_array = [] + with open(fname) as f: + + for line in f: + content_array.append(line) + print(content_array) + type(content_array) + +file_read(r'C:\Users\shreshtha\Desktop\abc.txt') + +Q3.Write a Python program to read a random line from a file. +Ans. + +import random +def random_line(fname): + lines = open(fname).read().splitlines() + return random.choice(lines) +print(random_line(r'C:\Users\shreshtha\Desktop\abc.txt')) + +Q4.Write a Python program to generate 26 text files named A.txt, B.txt, and +so on up to Z.txt. + +Ans. +import string, os +if not os.path.exists("letters"): + os.makedirs("letters") +for letter in string.ascii_uppercase: + with open(letter + ".txt", "w") as f: + f.writelines(letter) + +Q5.Write a Python program to combine each line from first file with the +corresponding line in second file. + +Ans. + +with open(r'C:\Users\shreshtha\Desktop\abc.txt') as fh1, open(r'C:\Users\shreshtha\Desktop\shre.txt') as fh2: + for line1, line2 in zip(fh1, fh2): + # line1 from abc.txt, line2 from test.txtg + print(line1+line2) + +Q6.Write a Python program to create a file where all letters of English +alphabet are listed by specified number of letters on each line. +Ans. + +import string +def letters_file_line(n): + with open("words1.txt", "w") as f: + alphabet = string.ascii_uppercase + letters = [alphabet[i:i + n] + "\n" for i in range(0, len(alphabet), n)] + f.writelines(letters) +letters_file_line(3) + +Q7.To scrap data from worldometer example: INDIA Data and run it +on live mode. +- Print Additionally total number of Coronavirus +Cases, Deaths, Recovered. + +Ans. + +import requests +from bs4 import BeautifulSoup +url='https://worldometers.info/coronavirus/' + +page=requests.get(url) +page=page.text +#print(page) + +soup=BeautifulSoup(page,"html.parser") +#print(soup) + +a=soup.findAll("div",{"class":"maincounter-number"}) +b=soup.findAll("h1") +for i in a: + print(i.text) +for j in b: + print(j.text) +