Which of the following words cannot be a variable in python language?
Two statements are given below:
Statement I: A ring topology is a type of network topology in which all devices are connected to a single cable.
Statement II: A bus topology is a type of network topology in which all devices are connected to a central hub or switch.
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Identify 'Y', where 'Y' is a computer network comprised by the interconnection of two or more LANs within a limited area.
What is the purpose of the rewind() function?
Directions: Match the contents under List I with those under List II.
What will the following statement do?
FILE *fp1;
Char Tch;
fp1=fopen("TCY.c","r");
while((Tch=getc(fp1)) != EOF)
printf("%c",Tch);
This method returns an integer that specifies the current position of the file object.
What is the output of the following program:
print((1, 2) + (3, 4))
Which of the following is an application of stack?
_____ requires user to specify what data is needed without specifying how to get it.
____ command helps to add new data to the database.
Which of the following best describes a white hat hacker?
Communication bandwidth that has the highest capacity and is used by microwave, cable and fibre optic lines is known as
Millions of computer science students have taken a course on algorithms and data structures, typically the second course after the initial one introducing programming. One of the basic data structures in such a course is the stack. The stack has a special place in the emergence of computing as a science, as argued by Michael Mahoney, the pioneer of the history of the theory of computing. The stack can be used in many computer applications; a few are given below:
(a) In recursive function
(b) When function is called
(c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix to Infix, Prefix to Infix
In stack, insertion operation is known as push, whereas deletion operation is known as pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Fill the statement based on the given question:
Q. Identify the suitable code for the blank of Statement 1.
Millions of computer science students have taken a course on algorithms and data structures, typically the second course after the initial one introducing programming. One of the basic data structures in such a course is the stack. The stack has a special place in the emergence of computing as a science, as argued by Michael Mahoney, the pioneer of the history of the theory of computing. The stack can be used in many computer applications; a few are given below:
(a) In recursive function
(b) When function is called
(c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix to Infix, Prefix to Infix
In stack, insertion operation is known as push, whereas deletion operation is known as pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Fill the statement based on the given question:
Q. Fill Statement 3, to check if the stack is empty.
Millions of computer science students have taken a course on algorithms and data structures, typically the second course after the initial one introducing programming. One of the basic data structures in such a course is the stack. The stack has a special place in the emergence of computing as a science, as argued by Michael Mahoney, the pioneer of the history of the theory of computing. The stack can be used in many computer applications; a few are given below:
(a) In recursive function
(b) When function is called
(c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix to Infix, Prefix to Infix
In stack, insertion operation is known as push, whereas deletion operation is known as pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Fill the statement based on the given question:
Q. Fill Statement 5, to call the pop function.
Millions of computer science students have taken a course on algorithms and data structures, typically the second course after the initial one introducing programming. One of the basic data structures in such a course is the stack. The stack has a special place in the emergence of computing as a science, as argued by Michael Mahoney, the pioneer of the history of the theory of computing. The stack can be used in many computer applications; a few are given below:
(a) In recursive function
(b) When function is called
(c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix to Infix, Prefix to Infix
In stack, insertion operation is known as push, whereas deletion operation is known as pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Fill the statement based on the given question:
Q. Fill Statement 2, to insert the alternate element from Country list.
Millions of computer science students have taken a course on algorithms and data structures, typically the second course after the initial one introducing programming. One of the basic data structures in such a course is the stack. The stack has a special place in the emergence of computing as a science, as argued by Michael Mahoney, the pioneer of the history of the theory of computing. The stack can be used in many computer applications; a few are given below:
(a) In recursive function
(b) When function is called
(c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix to Infix, Prefix to Infix
In stack, insertion operation is known as push, whereas deletion operation is known as pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Fill the statement based on the given question:
Q. Fill Statement 4, to delete an element from the stack.
Which of the following File open modes is used for opens the file in read,write and binary mode?
How many swaps are required to sort the list L2 using selection sort?
L2: [54, 23, 12, 44, 18, 22, 14]
In python, to support enqueue and dequeue operations which operations are used?
Which of the following statement are true?
Statement 1: dump() method is used to write the objects in a binary file.
Statement 2: load() method is used to read data from a binary file.
Which method is called before calling POP() method in the program.
What is the output for the given python program?
try:
sum=5/2;
except ZeroDivisionError:
print("Hello India")
else:
print("Hello world")
try:
sum=5/0;
except ZeroDivisionError:
print("Hello India")
else:
print("Hello world")
Which of the following File open modes is used for Opens the file in append mode?
Note: If the file doesn’t exist, then a new file will be created.
What is the output for the given python code? (If the file does not exist)
try:
fileptr = open("file.txt","r")
except IOError:
print("File not found")
else:
print("The file opened successfully")
fileptr.close()
Which operation is used to view elements at the front of the queue, without removing it from the queue?
If two lists are given such as:
L1: [2, 4, 6, 8, 10]
L2: [10, 4, 6, 8, 10]
If the lists are sorted using Insertion sort then which of the lists List1 or List 2 will make the minimum number of comparisons?