Question

Pawan is confused in understanding Dictionary concept. Help him to understand the concept by choosing the appropriate answer.

(a) Which statement will display Not Available?

(i) Statement 9 (ii) Statement 10

(iii) Statement 11 (iv) Statement 13

(b) Choose the key from Dictionary.

(i) ADMNO (ii) ‘admno ’

(iii) 101 (iv) “Not Available ”

(c) Which statement will display None?

(i) Statement 9 (ii) Statement 10

(iii) Statement 11 (iv) Statement 13

(d) Which Statement will display Tejas?

(i) Statement 8 (ii) Statement 9

(iii) Statement 10 (iv) Statement 11

(e) Choose the identifier.

(i) ADMNO (ii) ‘admno ’

(iii) setdefault (iv) Not Available

Answer

(a) (iii) Statement 11

(b) (ii) ‘admno ’

(c) (iv) Statement 13

(d) (ii) Statement 9

(e) (i) ADMNO

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

(a) Create the Dictionary Student with the following key and add the 5 values. Dictionary will be created from 4 different list:

Column Name Key
Student Number sno
Student Name sname
E-mail mail
Marks mark

(b) Create the data frame for the above specification containing index parameter along with column.

(c) Add a new column grade into above Data Frame with at least 3 methods.

(d) Insert the 2 rows.

(e) Create another Data Frame with two rows named DF2.

(f) Add this data frame to your existing data frame.

(g) Display the alternate rows.

(h) Display the name and marks of the students whose marks is greater than equal to 90.

(i) Fill all NaN in the data.

(j) Increase the marks by 10.

Write some of the health issues caused due to technology.
Write the few negative points related to the usage of technology in our society.
Choose the correct option.
(a) What is String data-type in Python?
(i) It is written in double quotes only.
(ii) Its value can be changed.
(iii) It is enclosed in square brackets.
(iv) It is immutable data-type.
(b) Ms. Ragini is confused on the way to compare the strings. Help her in choosing the correct statement.
(i) equal() (ii) equals()
(iii) == (iv) compare()
(c) Tejas is confused in the output of the following code. Help him to choose the correct option.
age = 12
txt = "My name is Tejas, I am ", age
print(txt)
(i) ('My name is Tejas, I am ', 12)
(ii) My name is Tejas, and I am 12
(iii) (My name is Tejas, I am , 12)
(iv) [My name is Tejas, I am , 12]
(d) Help mini to choose the correct output of the following Python code.
rollno = 3
name = "Mini "
Average = 88.76
Txt = "My name is {1}, having roll no {0} and scored {2} percent."
print(Txt.format(rollno, name, Average))
(i) My name is ‘Mini ’, having roll no 3 and scored 88.76 percent.
(ii) My name is Mini, having roll no 3 and scored 88.76 percent.
(iii) ‘My name is Mini, having roll no 3 and scored 88.76 percent.’
(iv) (My name is Mini, having roll no 3 and scored 88.76 percent.)
(e) Help Gurnika to choose the correct option for the following Python code.
b = "Hello, World!"
print(b[-5:2])
(i) Hello, World! (ii) orl
(iii) Error (iv) No Output
Read the following code carefully which is implementing the concept of STACK:

Now answer the following based on the code given:

(a) How are the above two functions interrelated?

(i) The function isEmpty(STACK) will be called when pop(STACK) is called

(ii) The function pop(STACK) will be called when is Empty(STACK) is called

(iii) Both functions are implementing recursion

(iv) These functions are not related to each other.

(b) What is the difference in between STACK.pop() and pop(STACK)

(i) Both are pre-defined functions

(ii) Both are user-defined functions

(iii) STACK.pop() is pre defined and pop(STACK) is user defined

(iv) STACK.pop() is user defined and pop(STACK) is pre defined

(c) What is the return type of the function defisEmpty (STACK)

(i) None (ii) void

(iii) int (iv) Boolean

(d) What will the pop(STACK) function return if the stack already consist of [‘A’,’B’] at the position 0 and 1 respectively

(i) A (ii) B (iii) Both A and B (iv) None

(e) if len(STACK) == 0: What is the purpose of this line in the above code:

(i) It checks if the stack is already full

(ii) It checks if the stack can add more value in it or not

(iii) It checks if the stack is already empty

(iv) It checks if the stack exist or not

Mr. Iqbal is a programmer, who has recently joined the company and given a task to write a python code to perform the following binary file operations with the help of two user defined functions/modules:
(a)
Consider the SchoolBus table given below:
Table: School Bus
Rtno Area_covered Capacity Noofstudents Distance T ransporter Charges
1 Vasantkunj 100 120 10 Shivamtravels 100000
2 HauzKhas 80 80 10 Anand travels 85000
3 Pitampura 60 55 30 Anand travels 60000
4 Rohini 100 90 35 Anand travels 100000
5 Yamuna Vihar 50 60 20 Bhalla Co. 58000
6 Krishna Nagar 70 80 30 Yadav Co. 80000
7 Vasundhara 100 110 20 Yadav Co. 100000
8 Paschim Vihar 40 40 20 Speed travels 55000
(a) State the command that will give the output as:
Area_covered
Yamuna Vihar
Krishna Nagar
Vasundhara
(i) select area_covered from schoolbus where transporter Yadav Co.'and transporter='Bhalla Co.';
(ii) select area_covered from schoolbus where not transporter-Yadav Co.'and transporter=Bhaila Co.';
(iii) select area_covered from schoolbus where transporter - Yadav Co.'
OR transporter'Bhalla Co.';
(iv) select area_covered from schoolbus where transporter IN("Yadav co.", -Bhalla co."):
Choose the correct option:
(i) Both (i) and (ii). (ii) Both (iii) and (iv).
(iii) Any of the options (i), (ii) and (iv) (iv) Only (iii)
(b) What will be the output of the following command?
Select * from schoolbus where distance=20 order by charges;

(c) Ravi has given the following command to obtain the Longest distance Select max(distance) from schoolbus where group by transporter;
But he is not getting the desired result.
Help him by writing the correct command.
(i) select max(distance) from schoolbus where group by transporter;
(ii) select transporter, max(distance) from schoolbus group by distance;
(iii) select transporter, max(distance) group by transporter from schoolbus;
(iv) select transporter, max(distance) from schoolbus group by transporter;
(d) Help Saumya to write the command to display the name of the transporter who is having lowest capacity in his schoolbus?
(i) select transporter.min(capacity) from schoolbus;
(ii) select transporter.max(capacity) from schoolbus:
(iii) select transporter.min(capacity) from schoolbus group by transporter:
(iv) select transporter.maximum(capacity)
(e) Choose the appropriate primary key.
(i) Transporter (ii) Area_covered (iii) Rtno (iv) Charges
Answer the following question on the basis of given dataset:

a b c d
0 1 2 3 4
1 100 200 300 400
2 1000 2000 3000 4000

(i) To create the data frame for the above dictionary.

(ii) To print the dictionary.

(iii) To change the index of the above data frame 'a1','a2','a3'.

(iv) To change the columns headings to 'units','tens','hundred',' thousand'.

(v) To display the tens columns.

(vi) To create another datframe with values of thousand.

(vii) To use the iterrows() to display the complete records.

(viii) To display the column wise data using iteritems().

Write the output on the basis of the given data frame:

units tens hundred thousand
a1 1 2 3 4
a2 100 200 300 400
a3 1000 2000 3000 4000

Krishna is confused in Python code given below. Please help him to answer the following questions.

(a) Which line in the above code check for capital letter?

(b) Which line in the above code read the file “story. txt”?

(c) Which line in the above code does not affect the execution of program?

(d) Which line is the above code coverts capital letter to small letter?

(e) Which line is the above code opens the file in write mode?

(f) Which line is the above code saves the data?

(g) Which line(s) is/are the part of selection statement.

(h) Which line(s) is/are used to close story1.txt?

Consider the table LOANS given below:

Table: LOANS

AccNo Name Loan Amt EMI IntRate Start Date Interest
1001 R.K. Gupta 300000 36 12.00 19-07-2009 1200
1002 S. P. Shanna 500000 48 10.00 22-03-2008 1800
1003 K.P. Jain 300000 36 NULL 08-03-2007 1600
1004 M.P. Yadav 800000 60 10.00 06-12-2008 2250
1005 S.P. Sinlia 200000 36 12.50 03-01-2010 4500
1006 P. Shanna 700000 60 12.50 05-06-2008 3500
1007 K.S. Dhall 500000 48 NULL 05-03-2008 3800

(a) State the command that will give the output as:

Name
S. P. Shanna
K.S. Dhall
M.P. Yadav
P. Shanna
K.S. Dhall

(i) Select name from LOANS where Name >‘D ’;

(ii) Select name from LOANS where AccNo >1001;

(iii) Select name from LOANS where Loan_Amt >= 500000;

(iv) Select name from LOANS where Loan_Amt >500000 order Loan_AmtDESC;

(b) What will be the output of the following command:

Select name, EMI from LOANS where Loan_Amt >500000 and Int_Rate is NULL;

(c) John has given the following command to display the count of all loan holders whose name ends with “Sharma ”:

Select count() from LOANS where Name like ‘Sharma%’;

But he is not getting the desired result. Help him by finding out the correct command fromthe followings:

(i) Select count(*) from LOANS where name Like ‘Sharma%’;

(ii) Select count(*) from LOANS where name Like ‘%Sharma ’;

(iii) Select count( ) from LOANS where name like ‘%sharma ’;

(iv) Select count(Name) from LOANS where name ‘Sharma%’;

(d) State the command to display the maximum Loan_Amt and Cust_Name :-

(i) Select Max(Cust_Name, Loan_Amt) from LOANS;

(ii) Select Cust_Name, max(LoanAmt) from LOANS;

(iii) Select Cust_Name, max(Loan_Amount) from LOANS;

(iv) Select Cust_name, max(Loan_Amt) from LOANS;

(e) Help Ramesh to display the count of all loan holders whose interest is NULL.

(i) Select Count(*) from LOANS where Int_Rate is NULL.

(ii) Select Count() from LOANS where Interest is NULL.

(iii) Select Count(*) from LOANS where Int_rate = NULL;

(iv) Select Count( ) from LOANS where Interest = NULL;