0% found this document useful (0 votes)
40 views3 pages

Ass 1

The document provides an assignment with 25 questions related to algorithms, flowcharts, C programming concepts like data types, operators, functions, loops etc. Students are asked to write algorithms, draw flowcharts and write C code to solve problems related to calculations, conditional checking, type conversions etc.

Uploaded by

Nityam Joshi
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)
40 views3 pages

Ass 1

The document provides an assignment with 25 questions related to algorithms, flowcharts, C programming concepts like data types, operators, functions, loops etc. Students are asked to write algorithms, draw flowcharts and write C code to solve problems related to calculations, conditional checking, type conversions etc.

Uploaded by

Nityam Joshi
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/ 3

Charotar University of Science and Technology [CHARUSAT]

Devang Patel Institute of Advance Technology and Research


[DEPSTAR]
Subject: CE143 Computer Concepts & Programming

Instructions:
• Write an assignment in full scape book.
• The assignment will be evaluated in terms of uniqueness, quality of answers, knowledge and
timely submission of the assignment before deadline.
• Deadline: 18/11/2022
Assignment-1
1) List out advantages of Algorithm and flowchart.
2) Write an algorithm to find average of Even number between 1-50.
3) Design flow chart to create given series “0,1,1,2,3,5,8,13 “. (Fibonacci series)
4) Write an algorithm and draw a flowchart to read the marks of a student and classify
them into different grades. If the marks secured are greater than or equal to 90, the
student is awarded Grade A; if they are greater than or equal to 80 but less than 90 ,
Grade B is awarded ; if they are greater than or equal to 65 but less than 80, Grade C is
awarded; otherwise Grade D is awarded.
5) Write an algorithm and draw a flowchart to find whether a number is Perfect Number
or not.
6) Write an algorithm and draw a flowchart to calculate the parking charges of a vehicle.
Input type of a vehicle (bus, truck, car) and number of hours. Calculate the charges as
given below: truck / bus - 20 rs per hour car – 10 rs per hour scooter/bike = 5 rs per
hour.
7) Draw a flow chart to evaluate following series.
1 + x + x2/2! + x3/3! + ………+ xn/n! where 0<x<1.
8) Define: Debugging, Interpreter, Compiler, Keyword, Token.
9) What is different between Header file and library file? What is the purpose of header
file? Is the use of header file absolutely required?
10) Explain data type in C with appropriate example
11) Define the rules for variable and constant declaration (#define and const).
12) Explain Preprocessor directive named Macro Expansion without argument and with
argument? What do you mean by Macro Templates (Symbolic name) and Macro
Expansion (Symbolic constant)? Explain two advantages of using symbolic constant.
How do variable and symbolic name differ?
Example: Write a program to calculate area of two circle. (πr2). Use Preprocessor
directive named macro expansion for the symbol π (Symbolic Constant) without
argument and with argument. Use typedef to rename the float datatype.
13) What is role of comments in programming language.
14) Draw and explain the basic structure of C Language.
15) C program to find largest among four numbers using ternary operator.
16) Which of the following data definition statements are illegal and why?
1. int Alf, Bert=4, Cleo=4.3, Doris='D';
2. char Eric=257, Eric_Again, 3rd_Eric;
3. short Default, Default_Value, default, default2;
4. long int, Fred=123456789;
5. Float x=123.456, Y=100 e-6;
6. unsigned negative = -1;
7. const int three = 4, Max, Eric=0;
8. unsigned float George = 1.234;
17) Given the following data declaration statements: int Ali, John=2, Steve=3;
Assuming integers are stored in 16 bits and long integers in 32 bits, what is the value in
each variable after each of the following statements:
Ali = John * 2 + Steve / Steve; Ali = John << 2 + Steve;
Ali = 12 / John*Steve;
Ali = ((-1 ^ John) & 7) | Steve; Ali = John++ + ++Steve;
18) Write a program to input a character using getchar() and print the character using
putchar() and check the character category. Also convert uppercase alphabet to lower
case and vice versa. (Use Character Test Functions: isalnum(), isalpha(), isdigit(),
islower(), isprint(), ispunct(), isspace(), isupper()) and (toupper() & tolower()) of
<ctype.h> header file.
19) Explain precedence and associativity with suitable example.
20) Explain implicit and explicit type conversion with example.
21) A library charges a fine for every book returned late. For first 5 days the fine is 50 paisa
per day, for 6-10 days fine is one rupee per day and above 10 days fine is 5 rupees per
day. If you return the book after 30 days your membership will be cancelled. Write a
program to accept the number of days the member is late to return the book and display
the fine or print the appropriate message.
22) Rewrite the following code using nested if...else statement. Z = (sal == 10000)?
(sal*0.1): ((sal< 10000)? 9000 :(sal*0.12));
23) Write a C program using switch case to calculate the fare of passengers travelling from
Ahmedabad to different cities. Calculate the total fare (Fare*No. of passengers) by
collecting the initial letter of city, no. of passengers.

24) Write a C program and draw a flowchart, for below given scenario. Take a user input
through keyboard as temperature in centigrade and display a suitable message according
to the temperature conditions mentioned below.
25) Write a program to do following:
a) Input an amount and convert it into rupees and paisa. (For Ex. 25.67 Rs = 25 Rs
and 67 Paisa). (Implicit type Conversion)
b) Input No of female and No of male and calculate the ratio of females to males in
a town. No of female and No of male are in int and ratio is in float. (For Ex.
No_of_Female = 10 & No_of_Male = 7 then ratio = 1.43). (Explicit type
Conversion.

You might also like