B.
TECH/AEIE/BT/CE/CHE/ECE/EE/ME/1ST SEM/CSE1001/2024
PROGRAMMING FOR PROBLEM SOLVING
(CSE1001)
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) Packed BCD representation of the decimal number 123 is
(a) 0000 0001 0010 0011 (b) 0001 0010 0011 0000
(c) 0000 0001 0000 0010 0000 0011 (d) None of these.
(ii) What will be the value of b, If (X1)6 = (127)b?
(a) 3 (b) 2 (c) 3 and 2 both (d) None of these.
(iii) Meaning of x >> 3 is same as
(a) x / 3 (b) x * 8 (c) x * 3 (d) x / 8
(iv) Which of the following is used as a string termination character?
(a) \n (b) \0 (c) /0 (d) \t
(v) What is the default return type of malloc( )?
(a) int (b) (int*) (c) (void*) (d) void
(vi) What will the output be?
#define SQUARE(X) X * X
int main ( )
{
printf (“\n Square = %d” , SQUARE(10+2) );
return 0;
}
(a) 144 (b) 100 (c) 32 (d) 34
(vii) Consider the following two statements written in C language:
FILE * fp;
fp = fopen(“TEST.TXT”, ”r+”);
Which of the following operations can be performed on the file named as
“TEST.TXT”?
(a) Only reading (b) Only writing
(c) Both reading and writing (d) Appending.
1
(viii) In C language, FILE is of which data type?
(a) int (b) char* (c) struct (d) unsigned long int
(ix) How many byte/s does “char” data type occupies in memory?
(a) 1 (b) 8 (c) 10 (d) 4.
(x) What is the output of the following code?
(a) Equal (b) Unequal (c) Error (d) None of these
Fill in the blanks with the correct word
(xi) The output of the following program is ________________________.
(xii) (24562.76)8 = (_____________)16
(xiii) The ________________ statement is used to terminate a loop in C.
(xiv) To copy a string from one variable to another, we use the function ________________.
(xv) The function ________________ is used to dynamically change the size of previously
allocated memory.
Group - B
2. (a) Convert the following:
(i) 25.62510 = (?)2 (ii) 362.358 = (?)10
(iii) 42A.1216 = (?)10 [(CO2)(Apply/IOCQ)]
(b) Consider the decimal number +2.7. Convert this number to its equivalent
IEEE754 32-bit floating point representation. [(CO2)(Apply/IOCQ)]
(c) Consider the following IEEE754 32-bit pattern: 1 10000001
01000000000000000000000. What is the decimal value that the above pattern
represents? [(CO2)(Apply/IOCQ)]
(2 + 2 + 2) + 3 + 3 = 12
2
3. (a) Imagine a signed integer variable is represented by 3 bits. Then what is the range
of numbers accepted by this variable. [(CO2)(Analyse/HOCQ)]
(b) Briefly describe the functions of different components of a conventional digital
computer with a suitable block diagram. [(CO1)(Remember/LOCQ)]
(c) Draw a flowchart to print the largest of three numbers. [(CO3)(Apply/IOCQ)]
3 + 5 + 4 = 12
Group - C
4. (a) Briefly discuss about relational operators and logical operators of C language
along with suitable examples. [(CO2, CO3)( Remember /LOCQ)]
(b) Write a C program to find the sum of the following series, where x and n will be
given as input:
S = x+x2+ x4+ x8+ x16 ....... up to nth term. [(CO3, CO5)( Apply /IOCQ)]
6 + 6 = 12
5. (a) Find out the maximum and minimum of two numbers using ternary operator.
[(CO3)(Apply/LOCQ)]
(b) Briefly explain about the basic data types that C language supports.
[(CO2, CO3)(Remember/LOCQ)]
(c) Write a C program to print all the prime numbers between 1 to n, where n is a
user input. [(CO3, CO5)(Apply/IOCQ)]
3 + 4 + 5 = 12
Group - D
6. (a) What is the difference between recursive and non-recursive functions? Give their
merits and demerits. [(CO3, CO4)(Analyse/IOCQ)]
(b) Write a C program to store Fibonacci series in an array. [(CO4, CO5)(Remember/HOCQ)]
(c) What is the importance of the register storage class? [(CO2)( Remember/LOCQ)]
(2 + 2) + 5 + 3 = 12
7. (a) What is a string? Explain the purpose and usage of string library functions-
strcpy( ), strlen( ) and strcmp( ). [(CO3, CO4)(Analyse/IOCQ)]
(b) What are command-line arguments in C? How do you pass arguments to the
main() function? [(CO4)(Remember/LOCQ)]
(c) Write a C program to dynamically allocate memory for an array of integers and
initialize it. [(CO5)(Apply/IOCQ)]
(1 + 3) + (2 + 2) + 4 = 12
Group - E
8. (a) Create a structure student with the fields - name, roll no, gender and section.
Create an array of n (user input) students and store their information by
3
accepting data from the user. Then display the names and roll numbers of all male
students. [(CO6)(Analyse/IOCQ)]
(b) Write a C program that will print the last three characters from the content of a
.txt file. [(CO5)( Evaluate/HOCQ)]
6 + 6 = 12
9. (a) Write a C program to copy the contents of a text file to another text file where the
source and destination file names will be entered through command line.
[(CO4,CO6)(Apply/HOCQ)]
(b) Define a structure called 'Distance' comprising of two integer attributes: 'feet' and
'inches'. Write a program that takes input for two distances in feet and inches,
calculates their sum, and displays the result in feet and inches.
[(CO4, CO6)(Apply/IOCQ)]
6 + 6= 12
Cognition Level LOCQ IOCQ HOCQ
Percentage distribution 26 53 21