0% found this document useful (0 votes)
72 views4 pages

21CSS101J 12.12.2023 FN

Programming for Problem Solving QP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
72 views4 pages

21CSS101J 12.12.2023 FN

Programming for Problem Solving QP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
Reg. No | B.Tech/M.Tech(Integrated) DEGREE EXAMINATION, DECEMBER 2023 First Semester 21CSS101J - PROGRAMMING FOR PROBLEM SOLVING (For the candidates admitted during the academic year 2022-2023 onwards) Part - A should be answered in OMR sheet within first 40 minutes and OMR sheet should be handed over to hall invigilator at the end of 40" minute. ii, Part - Band Part - C should be answered in answer booklet. Time: 3 Hours Max. Marks: 73 PART - A 20 x 1 = 20 Marks) Maris BL CO ‘Answer all Questions 1, The special character __can be used to declare a variable in C programming. road (A) anything (B) nothing (C) underscore (D) hyphen 2. which of the following is the default storage class for local variables in C 1 1 1 programming language? (A) auto (B) register (© static (D)extem 3. int a=33; int b=6; int x=a/b; printf(“%d"x); 1201 ‘What is the output of the above code snippet: as (B)55 jo @) 0.5 4, Write the output of the following C code snippet: 1201 int sl = -10; int Q= (sl++, +481): printi("%d\n", Q); (A) -8 il Ov @)2 5, Rewrite the following code to use the conditional operator rather than using an if 1 = 22 else. if (age>=18) then print eligible to vote. Otherwise print not eligible to vote. (A) (age>=18)? : printf( "eligible for (B) (age>=18) (printf("eligible for voting") , printf("not eligible for voting")) ? (print{("not eligible for voting! voting"); (©) (age>=18)? (printf(‘eligible for (D) (age>=18)? (printf(eligible for voting’)) ; (print{(‘not eligible for voting")) : (printf(*not eligible for voting’)): voting"); 6. Choose the correct answer for the following C code: 12 2 #include ‘void main() { for(int i=3; i<=6; i=i+2) { printi("i=%d".i); break; 3 I (A) 83555 (©) enor saper-21essi01s Page 1 of 4 10. th 12, 1B. 14, Page 2 of 4 Select the output for the following C program: #include void main() for(int i=1; i<5; i=i+4) { printf("i=%d",i); @®) 1; @) error When you run the following code, how many times will the message "Weleome" appear on the screen? #include void main() (int k=3; do printi(" Welcome\n" Ti: kek-l; goto Il; }while (k<=2); (A) onetime (B) two times (©) _ three times D) many times Which keyword is used to declare character array in C? (A) arr (B) string (Carr char ©) char ‘What will be the output of the following when collects the input as HAVE A GOOD. DAY? Hinclude void main() char af5]; scanfi"%s" a); printf("%s",a); } (A) HAVE GOOD DAY - @®) HAVE (C) Nothing will be printed ©) error Ifthe two strings are identical, then stremp() function returns (A)-1 @)I jo @) yes Which is the correct option when collecting string variable s1 values as“ABCD” in the C programming language. (A) string s1 = “ABCD”; (B) char si[10]="ABCD”; (© char si="ABCD”; (©) string si{10}-"ABCD”; ‘Which one of the following is the correct extension of the Python file? (A) python ®) py (C) numpy Op ‘What will be the output of the following function in Python? round(4.576) (Aya ®)5 (C)4.5 (D) 4.6 1 2 2 2 2 13 23 13 13 14 14 s20#1-216551015 1s. 16. 7. 18. 19. 20. 21. 22. 23. Page 3 of 4 Which of the following solution is correct when converting the given string, name="ABDUL KALAM'" to lower case in Python? (A) print(name.lower()) (B) print(name.toLower()) (© print(toLower(aame)) (©) print(ower(name)) Which one of the following is used to get the current time in Python? (A) import times ®)_ import print(time.asctime(time.localtime(time.time(JJ}jne; Print(localTime(time)) (C) import Time; (D) import time; Print(Time.asctime(localTime.time(time))) _print(localtime(time)) What is the output of the given Python code? x='10 y= 120" result = eval(x + y') print(result) (A) oxy ) 30 (© 1020 @) xy Select the appropriate output of the provided Python code. import numpy as np arr = np.zeros((1,2), dtype = int) print(arr) A) (12)) &) (01220 © ol @) [(00]) ‘What will be the output of the following Python code? import pandas as pd s =pa.Series({1,2,3,4,5],index= ['a',b';c''d'Je']) print(s['c'}) ) 5 @) ‘e" © 3 @) D To count the total number of elements in a dataframe in Python, we can use: (A) len @) count (© size (D) Values PART - B (4 « 10=40 Marks) Answer any 4 Questions ‘Venkat owns a boutique. He is dealing with an excel file that contains attributes such as the customerID, the Quantity purchased by the customer, the Amount of each item, and the Toial-price. In his 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 assignment statements. Find the size of the various data types of the specified variables and calculate Total-price. Assist him in writing a C programme for the mentioned purpose. Write a C program to calculate the following series using for loop. Sum = 1/37 + 2/43 + 3/5 + 4/6° + .... and print the result along with the series as the given format: when n=4; 1/37 + 2/43 + 3/54 + 4+6° = 0.14768 similarly, print the result according to the n® term. Write a C program for the following using user-cefined function with arguments: Collect four student's names such as "Dheetshitha", "Dharshika", "Iai" and "Dev" while declaring the variable "Names" using character array’ and assignment statement. Get any name fromi the user and then check whether the given name entered by the user is available in the specified character array. If't is available, then print the appropriate position of the given name otherwise print position as -1 102 4 102 4 1 2 3 1 205 1205 11s Marks BL CO wo 2 2 wm 3 2 wo 33 sabFt-21css1011 24. 26. 27. 28. Page 4 of 4 ‘Hema runs a fruit shop. She collects the customer-name with age and purchased fruit names, Help her to save the sample collected information using the following Python data types: i) list tuple ) dict iv) set vy) boolean Distinguish between PANDAS with NUMPY using different comparison parameters in Python programming language. Lakshmi writes a sentence in her notebook. She wants to count the number of uppercase characters, Jowercase characters, digits and special symbols in her sentence. Help her to find using a C program. PART - C (1 x 15 = 15 Marks) Answer any 1 Questions Two examinations were conducted for three groups of students namely Team 1, ‘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 total marks of both the examinations for all the three groups using C programming, language and print the results. Teami “2s um | Team ; 2 38 35 40: X= Team2’ 50 @ 2130 | Y= Team2 ) 18 2 7 w , | i Team3‘% ® 3 40 Team3 | e147 2 18 Raman has two boxes, both of which are coloured blue and green. The blue colour 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(); i, _void subtract(int, int); iii, int multiply(int, int); wo 2 4 wo 2 5 wo 3 3 ‘Marks BL CO 302 3003 raprt-2tcss101)

You might also like