Seat No: ______________ Enrollment No: ____________________
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
B.Tech. SummerWinter 2023 - 24 Examination
Semester: 1 Date: 22/01/2024
Subject Code: 303105104 Time: 2:00 pm to 4:30 pm
Subject Name: Computational Thinking for Structured Design-1 Total Marks: 60
Instructions:
1. All questions are compulsory.
2. Figures to the right indicate full marks.
3. Make suitable assumptions wherever necessary.
4. Start new question on new page.
Q.1 Objective Type Questions - (Fill in the blanks, one word answer, MCQ-not more (15) CO PO Bloom’s
than five in case of MCQ) (All are compulsory) (Each of one mark) Taxonomy
1. Which of the following language does the computer understand? 1 1 1 1
a) Computer understands only C Language
b) Computer understands only Assembly Language
c) Computer understands only Binary Language
d) Computer understands only BASIC
2. All keywords in C are in Uppercase letters. (Statement True/False) 1 1 1 1
3. The C-preprocessors are specified with _________ symbol. 1 1 1 1
4. What is the sizeof(char) in a 32-bit C compiler? 1 1 1 1
5. Which of the following is not a valid C variable name? 1 1 1 1
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
6. What will happen if the following C code is executed? 1 1 2 3
#include <stdio.h>
int main()
{ int main = 3;
printf("%d", main);
return 0; }
7. What is a built-in function in C? 1 1 1 1
8. Which of the following declaration is not supported by C language? 1 1 2 1
a) String str;
b) char *str;
c) float str = 3e2;
d) Both “String str;” and “float str = 3e2;”
9. What is recursion in C? 1 1 1 1
10. What is a pointer in C? 1 1 1 1
11. What is the result of logical or relational expression in C? 1 1 1 1
a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive number if an expression is true
d) None of the mentioned
12. What is the output of the following code snippet? 1 1 2 3
#include <stdio.h>
int main() {
int a[] = {1, 2, 3, 4};
int sum = 0;
for(int i = 0; i < 4; i++) {
Page 1 of 3
sum += a[i];
}
printf("%d", sum);
return 0;
}
13. What is the output of the following code snippet? 1 1 2 3
int main() {
int sum = 2 + 4 / 2 + 6 * 2;
printf("%d", sum);
return 0;
}
14. The global variables are ____________. 1 1 1 1
15. Which of the following return-type cannot be used for a function in C? 1 1 1 1
a) char *
b) struct
c) void
d) none of the mentioned
Q.2 Answer the following questions. (Attempt any three) (15)
A) Explain why the following identifiers are invalid? 5 2 1 4
1. %age marks
2. x.y
3. amount_in_$
4. marks(1)
B) Describe the call by value mechanism with examples. 5 2 2 2
C) What is the pointer? 5 2 1 1
D) List and explain the relational and logical operators with examples. 5 2 1 1
Q.3 A) Compulsory (07) 5 3 3
An electricity board charges the following rates for the use of electricity: for the first
200 units 80 paise per unit: for the next 100 units 90 paise per unit: beyond 300 units
Rs 1 per unit. All users are charged a minimum of Rs. 100 as meter charge. If the
total amount is more than Rs 400, then an additional surcharge of 15% of total
amount is charged.
Write a program to read the name of the user, number of units consumed and print
out the charges.
B) Optional (08) 4 1 3
1. Explain the different types of loops in C with syntax.
2. Show how break and continue statements are used in a C-program, with
example.
OR
B) Optional (08) 4 3 5
1. What is an array? How a single dimension and two-dimension arrays
are declared and initialized?
2. Write a c-program using function to check whether the given number
is prime or not
Q.4 A) Optional (07) 4 3 5
1. Give the format for conditional operator. When is it used?
2. Write a C-Program using function to check whether a given character
is a vowel or not.
OR
A) Optional (07) 4 3 5
Page 2 of 3
1. How do you use a pointer as a formal parameter of a function which is
designed to manipulate an array? Explain.
2. Write a C Program to print the below tringle.
1
22
333
4444
55555
B) Compulsory (08) 4 3 3
What is call by address? Consider the swap function for swapping two numbers
and illustrate how call by address is done?
Page 3 of 3