Skip to content

New Submission #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions SHRESHTHA GUPTA/BigData-1.txt
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions SHRESHTHA GUPTA/Python_task.txt
Original file line number Diff line number Diff line change
@@ -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

Binary file added SHRESHTHA GUPTA/Talend Assignments/Aggregate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions SHRESHTHA GUPTA/linux-1.txt
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions SHRESHTHA GUPTA/linux-2.txt
Original file line number Diff line number Diff line change
@@ -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








34 changes: 34 additions & 0 deletions SHRESHTHA GUPTA/linux-3.txt
Original file line number Diff line number Diff line change
@@ -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








31 changes: 31 additions & 0 deletions SHRESHTHA GUPTA/python-1.txt
Original file line number Diff line number Diff line change
@@ -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







44 changes: 44 additions & 0 deletions SHRESHTHA GUPTA/python-2.txt
Original file line number Diff line number Diff line change
@@ -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
58 changes: 58 additions & 0 deletions SHRESHTHA GUPTA/python-3.txt
Original file line number Diff line number Diff line change
@@ -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.





93 changes: 93 additions & 0 deletions SHRESHTHA GUPTA/python-4.txt
Original file line number Diff line number Diff line change
@@ -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(j<len(list[i])):
sum+=ord(list[i][j])

j=j+1
new.append(sum)


i=i+1

print(new)

Q3.You have to run your Program at 9:00am. Date: 14th April 2020.
#HINT:
# You have to use datetime Module or time module.
# You have to convert your output in #LIST_FORMAT.
# [ '2020-04-13' , '17:11:01.952975' ]
# you can use this with the help of IF/Else statement.

Ans.

import datetime
a=str(datetime.datetime.now())
print(a)
b=a.split(" ")
if(b[0]=='2020-04-23' and b[1][1]=='9'):
print("hello world!")
else:
print("wrong timings!")

Q4.Given a tuple:
tuple = ('a','l','g','o','r','i','t','h','m')
1. Using the concept of slicing, print the whole tuple.
2. delete the element at the 3rd Index, print the tuple.

Ans.
1.tuple = ('a','l','g','o','r','i','t','h','m')
print(tuple[:])

2.my_tuple = ('a','l','g','o','r','i','t','h','m')
my_list = list(my_tuple)
my_list.pop(3)
my_tuple = tuple(my_list)
print(my_tuple)

Q5.Take a list REGex=[1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12]
- print only those numbers greator then 20
- then print those numbers those are less then 10 or equal to 10
- store these above two list in two different list.

Ans.


1.REGex=[1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12]
list1=[]
for i in REGex:
if(i>20):
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)

Loading