0% found this document useful (0 votes)
8 views

CT2 SET 2

This document outlines the details of Cycle Test II for the B.Tech program at SRM Institute of Science and Technology, including the course code, learning outcomes, and test structure. It consists of multiple parts with questions covering programming concepts in C and Python, data types, and functions. The test is scheduled for May 10, 2023, with a maximum score of 50 marks.

Uploaded by

nimishparmar06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

CT2 SET 2

This document outlines the details of Cycle Test II for the B.Tech program at SRM Institute of Science and Technology, including the course code, learning outcomes, and test structure. It consists of multiple parts with questions covering programming concepts in C and Python, data types, and functions. The test is scheduled for May 10, 2023, with a maximum score of 50 marks.

Uploaded by

nimishparmar06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Reg.

No
SRM Institute of Science and Technology
Faculty of Engineering and Technology
Slot F, Batch 1
SRM Institute of Science and Technology SET 2
OFF LINE
College of Engineering and Technology
CYCLE TEST – II
Academic Year: 2022-2023 (EVEN Semester)

Program offered: B.Tech Year / Sem: I/ II


Max. Marks: 50 Time : 9.45AM -11.30 AM
Date : 10-05-2023

Course Code and Title: 21CSS101J: Programming for Problem Solving

Course Learning Rationale (CLR):


CLR-1: Think and evolve with a logic to construct an algorithm and pseudo code that can be converted into a program.
CLR-2 : Utilize the appropriate operators and control statements to solve engineering problems
CLR-3 : Store and retrieve data in a single and multidimensional array
CLR-4 :Create custom designed functions to perform repetitive tasks in any application
CLR-5 :Create basic Abstract Data Types with python
Course Learning Outcomes (CLO):
CO-1: To solve problems through computer programming. Express the basic data types and variables in C
CO-2 : To use appropriate data types in simple data processing applications. To create programs using the concept ofarrays.
CO-3:Create string processing applications with single and multi-dimensional arrays
CO-4: Create user defined functions with required operations. To implement pointers in applications with dynamic memory
requirements
CO-5: Create programs using the python data types, loops, control statements for problem solving

Answer all questions


Part A (8x1=8 Marks)
Part A-Don’t Mark in question paper. Write in the answer sheet
Sl.N P Mark
Question CO BL
o O s
The builtin library function used to find the last occurrence of a character in a
1
string is 3 1 2 1
(a) strnstr() (b) laststr() (c) strchr() (d) strstr()
What is the minimum number of functions to be present in a C program? 3 1 2 1
2
(a) 1 (b) 2 (c) 3 (d) 4
What do you call STAR * and AMPERSAND & in a C program context?
int a=10, *p;
p=&a;
printf(“%d %d”, a, *p);
3 2 4 1
3 (a) *=Address of operator , & = Value at operator
(b) *=Address of operator , & = Address of operator
(c)*=Value at operator, & = Address of operator
(d) *=Value at operator, & = Value at operator
Reg.No
SRM Institute of Science and Technology
Faculty of Engineering and Technology
What is the output of C program with array?
int main()
{
char str[25];
scanf(“%s”,str); 3 2 4 1
4
printf(“%s”,str);
return 0;
}
//input : South Africa
(a) South (b) South Africa (c) S (d) Compiler error.
Suppose list1 is [1,3,2] , what is list1*2 ? 4 1 2 1
5 (a) [2, 4, 6] (b) [1, 3, 2, 1, 3 ] (c) [1, 3, 2, 1, 3, 2] (d) [1, 3, 2, 3, 2, 1]
6 What is the output of the following code ? 4 1 2 1
import numpy as np
a=np.arange(10)
print(a[2:5])
(a) [2, 3, 4] (b) [0, 1, 2] (c) [5, 6, 7] (d) [2, 4, 6]

Which library is to be imported for creating DataFrame ? 5 1 2 1


7 (a) Python (b) DataFrame (c) Pandas (d) Random
Which of the following attribute of DataFrame is used to display data type of 5 1 2 1
8 each column in DataFrame?
(a) Dtypes (b) DTypes (c) dtypes (d) datatypes
Part B (3x4Marks=12 Marks)
Sl.N Question CO PO BL Marks
o
9 In C, explain gets(), puts()function with an example 3 1 2 4
Syntax for Accepting String :
char * gets ( char * str ); OR gets( <variable-name> )
Example : #include<stdio.h>
void main()
{
char name[20]; printf("\nEnter the Name : "); gets(name); }
Output:
Enter the name: programming in c

Way 1 :Messaging
⚫ puts(" Type your Message / Instruction ");
⚫ Like Printf Statement puts() can be used to display
message.
Way 2 : Display String
⚫ puts(string_Variable_name) ;
Notes or Facts :
⚫ puts is included in header file “stdio.h”
⚫ As name suggest it used for Printing or Displaying
Messages or Instructions.
Reg.No
SRM Institute of Science and Technology
Faculty of Engineering and Technology
10 Write a python program to calculate simple interest 4 2 4 4
print("Enter the Principle Amount: ")
p = int(input())
print("Enter Rate of Interest (%): ")
r = float(input())
print("Enter Time Period: ")
t = float(input())
si = (p*r*t)/100
print("\nSimple Interest Amount: ")
print(si)
11 Write a Python program to find the average of 5 numbers using while loop 5 2 4 4
n = 5
total_numbers = n
sum = 0
while n >= 0:
sum += n
n -= 1
print("sum =", sum)
# Output sum =

average = sum / total_numbers


print("Average = ", average)
# Output Average

Part C ( 3x10=30 Marks)


Sl.N Question C PO BL Marks
o O
12 a. Write a program which converts the lowercase characters of a given string into 3 2 4 10
uppercase characters.
#include<stdio.h>
#include<conio.h>
int main()
{
char lowerChar, upperChar;
int ascii;
printf("Enter a lowercase Character: ");
scanf("%c", &lowerChar);
ascii = lowerChar;
upperChar = ascii-32;
printf("\nIts Uppercase = %c", upperChar);
getch();
return 0;
}

OR
12 Compare User defined functions and built in functions in C with one example 3 2 4 10
b.
Library / built-in functions User-defined functions
These functions are predefined in a These functions are not predefined rather it is defined
header file or preprocessor directive. by user according to the requirements.
These functions can be simply used by These functions should be declared, defined and
including respective header file. called in order to use.
Since, these functions are predefined Since, these functions should be defined by the user
programs are short. programs are lengthy.
Program execution time is faster. Program execution time is slower.
It simplifies the program. Using more user-functions increase complexity.
Eg, strlen( ), strcmp( ), strcpy( ), strcat( ) Eg, fact( ), average( ), greatest( ), anyname( )
Reg.No
SRM Institute of Science and Technology
Faculty of Engineering and Technology
13 a. Krishnan borrowed Rs. 23,500 from a bank to buy a scooter at a rate of 6.8% p.a., 4 2 4 10
compounded yearly. What amount will she pay at the end of 2 years and 2 months to
clear the loan? Therefore, could you help her to pay the correct amount by writing C
program to find the solution?
Program 6- mark
Formula -2Mark
Output- 2Mark
OR
13 Explain the basic list operations with examples. 4 1 2 10
b. Arithmetic Operators
Comparison Operators
Assignment Operators
Bitwise Operators
Logical Operators
Membership Operators
14 a. Explain python libraries with examples 5 1 2 10
1. TensorFlow: This library was developed by Google in collaboration with the Brain
Team. It is an open-source library used for high-level computations. It is also used in
machine learning and deep learning algorithms. It contains a large number of tensor
operations. Researchers also use this Python library to solve complex computations in
Mathematics and Physics.
2. Matplotlib: This library is responsible for plotting numerical data. And that’s why it is
used in data analysis. It is also an open-source library and plots high-defined figures like
pie charts, histograms, scatterplots, graphs, etc.
3. Pandas: Pandas are an important library for data scientists. It is an open-source machine
learning library that provides flexible high-level data structures and a variety of analysis
tools. It eases data analysis, data manipulation, and cleaning of data. Pandas support
operations like Sorting, Re-indexing, Iteration, Concatenation, Conversion of data,
Visualizations, Aggregations, etc.

OR

14 Explain the three types of indexing method in Numpy with suitable example. 5 1 2 10
b. Contents of ndarray object can be accessed and modified by indexing or slicing, just like Python's
in-built container objects.
items in ndarray object follows zero-based index. Three types of indexing methods are available
− field access, basic slicing and advanced indexing.
Basic slicing is an extension of Python's basic concept of slicing to n dimensions. A Python slice
object is constructed by giving start, stop, and step parameters to the built-in slice function.
This slice object is passed to the array to extract a part of array.
ndarray object is prepared by arange() function. Then a slice object is defined with start, stop,
and step values 2, 7, and 2 respectively. When this slice object is passed to the ndarray, a part
of it starting with index 2 up to 7 with a step of 2 is sliced.

You might also like