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

Programming For Problem Solving-Cse 1001-2024

The document outlines an examination paper for the course 'Programming for Problem Solving' (CSE 1001) for B.Tech students. It includes various groups of questions covering topics such as data types, memory management, flowcharts, and C programming concepts, with specific tasks for students to complete. The course aims to develop students' understanding of computer systems, programming environments, and problem-solving skills using C.

Uploaded by

aneeshpal956
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)
88 views4 pages

Programming For Problem Solving-Cse 1001-2024

The document outlines an examination paper for the course 'Programming for Problem Solving' (CSE 1001) for B.Tech students. It includes various groups of questions covering topics such as data types, memory management, flowcharts, and C programming concepts, with specific tasks for students to complete. The course aims to develop students' understanding of computer systems, programming environments, and problem-solving skills using C.

Uploaded by

aneeshpal956
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

B.

TECH/CSBS/CSE/CSE(AI&ML)/CSE(DS)/CSE(IOT)/IT/2ND SEM/CSE 1001/2024

PROGRAMMING FOR PROBLEM SOLVING


(CSE 1001)
Time Allotted : 2½ hrs Full Marks : 60
Figures out of the right margin indicate full marks.
Candidates are required to answer Group A and
any 4 (four) from Group B to E, taking one from each group.
Candidates are required to give answer in their own words as far as practicable.

Group – A
1. Answer any twelve: 12 × 1 = 12
Choose the correct alternative for the following
(i) The address of the array element A[3][5] can also be represented as:
(a) *(A+3)+5 (b) &(A+3)+5
(c) *(*(A+3)+5) (d) *A[3]+5
(ii) Which is the correct way to declare a pointer to integer?
(a) int_ptr; (b) int *ptr; (c) *int ptr; (d) int ptr*;
(iii) What is the output of the following code snippet?

(a) 10 (b) 16 (c) 28 (d) 64


(iv) Let the array A be initialized as: char A[10] = "HIT2024"; What is the value of
A[7]?
(a) ‘0’ (b) ‘\0’ (c) ‘4’ (d) Cannot be determined
(v) Suppose x is an unsigned int variable. Executing x >> 3 is same as,
(a) x/3 (b) x*(23 ) (c) x*3 (d) x/(23 )
(vi) Which of the following is the fastest memory unit?
(a) Cache (b) Register (c) RAM (d) Hard disk
(vii) If a C file is opened in “r+” mode, which of the following operations can be
performed on it?
(a) Read but not write (b) Write but not read
(c) Both read and write (d) None of these
(viii) p++ executes faster than p+1 because
(a) p uses registers (b) p++ is a single instruction
(c) ++ is faster than + (d) None of these
1
(ix) If the data type of a is int, b is float, c is double and d is long, what is the data
type of the final result when the following expression is evaluated?

(a) int (b) float (c) double (d) long


(x) ALU is a part of
(a) Memory (b) CPU (c) Output device (d) Input device.
Fill in the blanks with the correct word
(xi) Array index in C always start at ____________.
(xii) When an integer variable is defined using the const keyword but left
uninitialised, the value stored in it is __________.
(xiii) During the process of compiling a program, the phase where macros are
handled is called __________.
(xiv) For de-allocating dynamically allocated memory, you can use the ___________
function.
(xv) The expression (4-5+1) || (2*3) && (3/6) evaluates to the value __________.

Group - B
2. (a) Perform the following base conversions:
(i) (6A7C.5D)16 = (?)10
(ii) (1472.65)8 = (?)2 [(CO1)(Remember/LOCQ)]
(b) Compute 5 – 18 using 2's complement method. Assume that each number is
stored using 1 byte. [(CO1)(Understand/LOCQ)]
(c) Draw a flowchart to accept a number from the user and determine whether it is
a palindrome number. [(CO3)(Apply/IOCQ)]
(2 + 2) + 3 + 5 = 12

3. (a) A float type variable X has the decimal value of –31.225. What is the
representation of X using the IEEE-754 single-precision 32-bit floating point
format? [(CO1,CO2)(Apply/IOCQ)]
(b) Calculate (10000100)2 – (1100110)2 using 2's complement binary arithmetic.
[(CO1,CO2)(Understand/LOCQ)]
(c) Find r such that (121)𝑟 =(144)8 , where r and 8 are the bases. [(CO1,CO2)(Apply/IOCQ)]
4 + 4 + 4 = 12

Group - C
4. (a) What will be the output of the following code snippet? Justify your answer.

[(CO5)(Analyse/HOCQ)]
(b) Explain explicit and implicit type casting with an example. [(CO4)(Remember/LOCQ)]

2
(c) Write a program to print the following pattern where the number of lines is
accepted from the user:

[(CO5)(Apply/IOCQ)]
3 + 3 + 6 = 12

5. (a) Write a C program that accepts two inputs, 'x' and 'n', and computes the value of
the series up to 'n' terms for a given 'x' without employing a distinct factorial
x2 x3 x4 x5
function: 𝑥 − + − + − ⋯ [(CO4,CO5)(Analyse/HOCQ)]
2! 3! 4! 5!
(b) Write a C program that takes a sentence or a line of text as input and displays
the frequency of each vowel, along with the total count of consonants.
[(CO4,CO5,CO6)(Remember/LOCQ)]
6 + 6 = 12

Group - D
6. (a) Determine the return value of the function call ‘fun(5)’ given the following
definition of the function 'fun'. Include the step-by-step working for clarity.
int fun (int n)
{
if ( n == 0)
return 1;
return 2 * fun ( n – 1 );
} [(CO5)(Analyse/IOCQ)]
(b) What is the purpose of the static keyword in C? Explain with an example. Can a
global variable be declared as static? Explain your answer. [(CO4)(Remember/LOCQ)]
(c) Write a code snippet to dynamically allocate a 2D integer array having 10 rows
and 15 columns. [(CO6)(Apply/IOCQ)]
(d) What is meant by the scope of a variable? [(CO4)(Remember/LOCQ)]
4 + (2 + 1) + 3 + 2 = 12

7. (a) Explain the output of the following C program.


int main ( )
{
int a = 10;
{
printf (“value of a is %d\n”, a);
a = 20;
printf (“value of a is %d\n”, a);
{
int a = 30;
printf (“value of a is %d\n”, a);

3
a++;
}
printf (“value of a is %d\n”, a);
a++;
}
printf (“value of a is %d\n”, a);
return 0;
} [(CO4)(Analyse/HOCQ)]
(b) What is a function? What are the advantages of using a function? Can a function
effectively utilize the 'return' keyword to send multiple values to the caller? If
so, what approach enables this? [(CO4,CO5)(Remember/LOCQ)]
5 + (1 + 2 + 4) = 12

Group - E
8. (a) How can you check whether a file exists by using the fopen( ) function?
[(CO5,CO6)(Apply/LOCQ)]
(b) State the uses of fseek( ), ftell( ) and rewind( ) functions. [(CO6)(Remember/LOCQ)]
(c) Develop a C program that compares two dates provided by the user. Define a
structure called 'Date' to hold the day, month, and year components of the dates.
If the dates are identical, output 'Dates are equal'; otherwise, display 'Dates are
not equal'. [(CO5,CO6)(Apply/IOCQ)]
3 + 3 + 6 = 12

9. (a) Create a structure student with the fields name, roll_no, gender and section.
Dynamically create an array of n students and store their information by
accepting data from the user. Then display the names and roll numbers of all
male students of section B. [(CO6)(Analyse/IOCQ)]
(b) Write a C program which accepts the name of a file as a command line argument
and searches for that file in the current working directory. If the file is found, the
program computes the size of the file. Recall that each character contributes one
byte to the overall size. [(CO6)(Remember/IOCQ)]
6 + 6 = 12

Cognition Level LOCQ IOCQ HOCQ


Percentage distribution 39.6 45.8 14.6

Course Outcome (CO):

After the completion of the course students will be able to


CO1: Remember and understand the functionalities of the different hardware and software components present in a computer
system, the standard representations of various types of data in a computer system.
CO2: Illustrate how a computer system with one way of representation can be converted to one another equivalent representation.
CO3: Construct flow charts for any arithmetic or logical problems in hand.
CO4: Remember and understand the C programming development environment, writing, compiling, debugging, linking and
executing a C program using that development environment, basic syntax and semantics of C programming language and
interpret the outcome of any given C program.
CO5: Use loop constructs, conditional branching, iteration, recursion to solve simple engineering problems.
CO6: Apply pointers, arrays, structures, files to formulate simple engineering problems.

*LOCQ: Lower Order Cognitive Question; IOCQ: Intermediate Order Cognitive Question; HOCQ: Higher Order Cognitive Question.

You might also like