Pps Sem
Pps Sem
Note:
handed over to
i. Part - A should be answered inthOMR sheet within first 40 minutes and OMR. sheet should be
hall invigilator at the end of40 minute.
ii. Part - B and Part - C should be amwcrcd in answer booklet.
Time:3 Ho11n
Mau. Marks: 75
MarbBL CO
PART -A (20 >< I= 20 Marks)
Answer all Questions
(A) - 8 (B) 11
(C) 12 (D)-2
5. Rewrite the following code to use the conditional operator rather than using an if- 1
else.
if(age>= l8) then print eligible to vote. Otherwise print not eligible to vote.
(A) (age>=l8)?: printfl'"eligible for (B) (age>-18) (printft"eligible for
voting") , printf("oot eligible for voting")) ? (printfl:"not eligible for
voting"); voting")};
(C) (age>=IS)? (printf('eligible for (D) (age>=l8)? (printfl."eligible for
voting')); (printfl.'not eligible for voting")): (printf("noteligiblefor
voting')); voting"));
2
6. Choose the correct answer for the following C code:
#include<stdio.h>
void main()
Jor(int ja3; i<=6; i=i+2)
{ printf{"i=%d",i);
break;
}
}
(A) i=3; i=5 (B) i-3; i=4; i-5; i-6
(C) error (D) i=3
12Df1-21CSSI01J
Page 1 014
7. Select the oU1pUt for the following C program: 2 2
#include<stdio.h>
void main(}
{
for(int i=l; i<:5; i=i-+4)
{ printft"i=o/od",i);
continue;
}
}
(A) i=l; i=5 (B) i=l;
(C) i-1; i=4; (D) error
8. When you run the following code, how many times will the message "Welcome" 2 2
~ on the screen?
#include<stdio.h>
void maii:()
{ intk=S;
do
{.
printft"Welcome'IIl");
11: k=k-1;
goto 11;
}while (k<=2);
}
(A) one time (B) two times
(C) three times (D) lllllllY times
9. Which keyword is used to declare cbaracter array in C?
(A) arr Q.3) string
(C) arr char (D) char
10, What will be the output of the following when collects the input as HAVE A GOOD 2 3
DAY?
#include <stdio.h>
voidmainO
{
char a[S];
scanf("%s".a);
printf("%s",a);
}
(A) HAVE A GOOD DAY . (B) HAVE
(C) Nothing will be printed (D) error
11. If the two strings are identical, then lltrcmp() function returns 3
(A) -1 (B) 1
(C) 0 (D) yes
12, Which is the correct option when collecting string variable sl values as·"ABCD" in 3
the C programming language.
(A) string s l ="ABCD"; (B) char sl[l0]="ABC D";
(C) char sl="ABCD"; (D) string s1[10]-"ABC D";
13. Which one of the following is the correct exteosion of the Python file? 4
(A) .python (B) .py
(C) .numpy (D) .p
14. What will be the output of the following function in Python? 4
round(4.576)
(A)4 (B) 5
(C)4.5 (D) 4.6
15. Which of the following solution is COIJ'eCt when converting the given string, 2 4
name="ABDUL KALAMff t.o lower case in Python?
(A) print(name.lower()) (B) prin1(namc.toLoweI{))
(C) print(toLower(name)) (D) print(lowe:r(aame))
16. Which one of die following is used to get the current time in Python? 2 4
(A) import time; (B) import
print(time.asctime(time.localtime(time.~; Print(localTime(time))
(C) import Tune; (D) import time;
Print(Tme.asctime(localTime.time(time))) print(localtime(time))
17. What is the output of the given Python code? 2 5
x-'10'
y='20'
result = eval('x + y')
print(result)
(A) xy (B) 30
(C) 1020 (D) x+y
18. Select the appropriate output ofthe provided Python code. .1 2 5
import numpy as np
m=np.zeros((l,2), dtype = int)
print(arr)
(A) ((1 2)) (B) [[I l],[2 2))
(C) [O 1) (D) [[O OJ]
19. What will be the output of the following Python code? 2 s
import~das as pd
s ;,cl-: crics([l,2,3,4,5],indcx- ra','b','c','d','c'))
pnnt(src1)
(A) s • (B) 'c'
(C) 3 (D) D
20. To count the total number of elements in a dataframe in Python, we can use: 5
(A) Jen (B) count
(C) size (D) Values
PART-B(4 >< 10-40Marka) MarbBL co
Answer any 4 Questioos
21. Vellkat owns a boutiihe. He is dealing with an excel tile that contains attributes such 10
as the customerID, e Quantity ~ by the customer, the Amount of each
item, and the Total-price. In is C programme, he wishes to define the
aforementioned attributes as variables with appropriate data types such as character-
array, integer, float, and double and assign sample values to them using assif::t
statements. Find the size of the various data types of the specified variab es and
calculate Total-price. Assist him in writing a C programme for the mentioned
purpose.
22. Write a C grogl"lll!:I to calculate the following series using for loop. 10 3 2
Sum= 1/3 + 2/43 + 3/54 + 4/65 + .... and print the result along with the series as the
given format: when n=4; 1/32 + 2/43 + 315• + 4~5 = 0.14768 similarly, print the
result accoroing to then~ tenn.
23. Write a C program for the following using user-defined function with arguments: 10 3 3
Collect folD' student's names such as ''Dbeetshitha", "Dharshika", "Jai" and "Dev"
while declaring the variable "Names• using character array and assignment
statement. Get any name froni the user and then check whether the given name
entered by the user is available in the specified character array. If it is available, then
print the appropriate position ofthe given name otherwise print position as -1
24. Hema runs a fruit shop. She collects the aistomer-name with age and pun:hased fruit 10 2 4
names. Help her to save the sample collected information
using the following Python data types:
i) list
ii} tuple
ili) diet
iv) set
v) boolean
2S. Distinguish between PANDAS with NUMPY using different comparison parameters 10 2
in Python programming language.
3
26. Lakshmi writes a senteoce in her notebook. She wants to COID!t the number of 10
uppercase characters, lowercase characters, digits and special symbols in her
sentence. Help her to fmd using a C program.
PART - C (1 x 15 - 15 Marks)
Mlll'DBL co
Answer any 1 Questions
2
27. Two examinations were conductod for three groups of students namelY. Team 1, IS 3
Team 2, Team 3 and their data on average of marks for the subjects Tamil, English,
Science and Mathematics are given below in the form of matrices X and Y. Find the
tolal marks of both the examinations for all the three groups using C programming
lanRUBRC and print the results.
28. Raman bas two boxes, both of which are coloured blue and green. The blue colour IS
box only holds two chocolates, whereas the green box holds ten. He wants to use the
quantity of chocolates in hiS' boxes to do mathematical operations like addition,
subtraction, and multiplication. Help him by implementing the following user-
defined functions in a C program:
i. void add();
ii void subtract(int, int);
iii. int multiply(mt, int};
•••••