1. User can write Python script using
(a) mysql.connector library
(b) sql.connect library
(c) mysql.connect library
(d) None of the above
Ans.(a) User can write Python script using mysql.connector
library after installing Python MySQL connector.
2. Which of the following method is used to create a
connection between the MySQL database and
Python?
(a) connector ( ) (b) connect ( )
(c) con ( ) (d) cont ( )
Ans.(b) connect ( ) is used to create a connection between the
MySQL database and Python.
3. What is default value of host?
(a) host (b) localhost
(c) global host (d) None of these
Ans.(b) localhost is the default value of host.
4. Which command is used to display the name of
existing databases?
(a) display databases; (b) result databases;
(c) show databases; (d) output databases;
Ans.(c) show databases; command is used to display the
name of existing databases.
5. ......... operation is required when you want to
create your records into a database’s table.
(a) Update (b) Delete (c) Read (d) Insert
Ans.(d) Insert operation is required when you want to create
your records into a database’s table.
6. Which method returns the next row from the result
set as tuple?
(a) fetchone ( ) (b) fetchmany ( )
(c) fetchall ( ) (d) rowcount
Ans.(a) fetchone ( ) returns the next row from the result set as
tuple. If there are no more rows to retrieve, None is
returned.
1. Data structures are (a) network structures (b) group of data (c) different types of data (d) different operations on data Ans.(b) Data structures are group of data that have different data types, which can be accessed as a unit. 2. Which of the following is/are linear data structure(s)? (a) Array (b) Stack (c) Queue (d) All of these Ans.(d) Stack, queue and array all are linear data structures. 3. ............ of data structure means processing all the data elements of it. (a) Traversal (b) Searching (c) Insertion (d) Merging Ans.(a) Traversal of data structure means processing all the data elements of it. 4. Which data structure is needed to convert infix notation to postfix notation? (a) Branch (b) Tree (c) Queue (d) Stack Ans.(d) Stack is needed to convert infix notation to postfix notation. 5. Process of inserting an element in stack is called (a) Create (b) Push (c) Evaluation (d) Pop Ans.(b) When we add or insert any element ‘data’ in the list, then it will be called as ‘Push’ operation on stack. 6. Process of removing an element from stack is called (a) Create (b) Push (c) Evaluation (d) Pop Ans.(d) When we try to remove elements from the stack, then the operation is called as ‘pop’ operation on stack. 7. Pushing an element into stack already having five elements and stack size of 5, then stack becomes (a) Overflow (b) Uses flow (c) Crash (d) Underflow Ans.(a) Any attempt to insert a new element in already full stack results shows ‘Overflow’. 8. In a stack, if a user tries to remove an element from empty stack is called (a) Underflow (b) Overflow (c) Empty (d) Garbage collection Ans.(a) In a stack, if a user tries to remove an element from empty stack is called ‘Underflow’. 9. Integer, real, character, pointer and reference are ......... data structures. (a) primitive (b) non-primitive (c) linear (d) non-linear Ans.(a) Integer, real, character, pointer and reference are primitive data structures. Primitive data structures are directly operated by machine level instructions. 10. Pile of books is an example of ......... . (a) stack (b) queue (c) array (d) linked list Ans.(a) Pile of books is an example of stack.
Question from Stacks and Queue Set A Q1. Expand the term LIFO. Q2. What do you mean by Stack? Q3. What is the difference between pop( ) and append( ) function of list? Q4. What do you mean by data structure? Q5. Write a code to create an empty stack named "st". Q6. Write the technical term used for adding elements in the stack. Q7. What happens when you try to delete an element from an empty stack? Set B Q1. What is the difference between Stack and Queue data structure in python? Q2. In queue, addition and deletion of elements take place at different ends (T/F) Q3. Which method of list is used to add an element at the end ? Q4. Write the code to display all elements of queue named "Aqueue". Q5. Write a function addQ(num) to add numbers in a queue using a list. (num is a list of numbers) Q6. Write a full form of FIFO. Q7. Queue works on _______________(FIFO/LIFO) concept. Q8. Write 2 applications of stack. Q9. Which method of list is used to remove the last element of the list?
