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

First Module Unvsty Questions

The document outlines important questions and topics related to the C programming language, categorized into three parts: Part A covers basic concepts and functions, Part B discusses operators and program structure, and Part C focuses on tokens and algorithms. It also explains the significance and types of comments in C, detailing single-line and multi-line comments, along with their usage. Additionally, it describes formatted input and output functions such as printf() and scanf(), including examples and syntax.

Uploaded by

krupamariam008
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

First Module Unvsty Questions

The document outlines important questions and topics related to the C programming language, categorized into three parts: Part A covers basic concepts and functions, Part B discusses operators and program structure, and Part C focuses on tokens and algorithms. It also explains the significance and types of comments in C, detailing single-line and multi-line comments, along with their usage. Additionally, it describes formatted input and output functions such as printf() and scanf(), including examples and syntax.

Uploaded by

krupamariam008
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

FIRST MODULE IMPORTANT QUESTIONS

PART A

1. High lev language


2. Symbolic Constant
3. Scanf() ,printf() functions with Example
4. Use of #include
5. Explain getchar() and putchar()
6. Give 2 example for keywords
7. Logical operator in C language
8. What is escape sequence
9. Character set
10. Newline Character
11. Gets n puts with example

Part B
1. Explain significant of C
2. Assignment operator in detail
3. Design a flow chart to find average of 2 numbers
4. Bitwise operator in detail
5. Explain methods to add comments in c program
6. Formatted input and output in detail
7. Structure of c program with example
8. Arithmetic operator with examples

Part c
1. Tokens in C with example
2. Algorithm n flowchart to find the biggest of 10 number given as input
3. Process involved in Design n development of a program
4. C tokens in detail
C Comments

The comments in C are human-readable explanations or notes in the source code of a C program. A
comment makes the program easier to read and understand. These are the statements that are not
executed by the compiler or an interpreter.

When and Why to use Comments in C programming?

1. A person reading a large code will be bemused if comments are not provided about details
of the program.

2. C Comments are a way to make a code more readable by providing more descriptions.

3. C Comments can include a description of an algorithm to make code understandable.

4. C Comments can be used to prevent the execution of some parts of the code.

Types of comments in C

In C there are two types of comments in C language:

 Single-line comment

 Multi-line comment

Types of Comments in C

1. Single-line Comment in C

A single-line comment in C starts with ( // ) double forward slash. It extends till the end of the line
and we don’t need to specify its end.

Syntax of Single Line C Comment

// This is a single line comment

Multi-line Comments in C

In C programming, there is another type of comment that allows us to comment on multiple lines at
once, they are multi-line comments.

To write multi-line comments, we use the /*....*/ symbol.

For example,

/* This program takes age input from the user

It stores it in the age variable

And, print the value using printf() */

#include <stdio.h>

int main() {

// create integer variable

int age = 25;


// print the age variable

printf("Age: %d", age);

return 0;

Formatted Input and Output in C?

We use the formatted input and output functions in the C language for taking single or multiple
inputs from the programmer/user at the console. These functions also allow a programmer to
display single or multiple values, in the form of output, to the users present in the console.

Functions Description of the Function


Used

printf() We use this function for displaying a single or multiple values in the form of output for the user
end at the console.

scanf() We use this function for reading a single or multiple values in the form of input from the user
end at the console.

sprintf() We use this function for reading the values that are stored in various variables, and for storing
these values into the array of characters.

sscanf() We use this function for reading the characters available in the string, and then storing them into
the available variables.

Syntax for printf()

printf (format_specifiers, info_a, info_b,…….. );

Example of printf()

printf(“%d %c”, info_a, info_b);

The character that we specify after the ‘%’ character refers to the conversion character. It is because
‘%’ allows the conversion of any given data type into another data type for further printing.

Conversion Description and Meaning of Character


Character

c The program takes the data in the form of characters.

d The program performs the conversion of the data into integers (decimals).

f The program generates data output in the form of a double or a float with the default of a
Precision 6.

s The program identifies the data as a string, and a single character from this string gets
printed unless and until the program reaches a NULL character.

printf (“%d\n%c”, data1, info_2);

printf (“Number: %d\n”, info_1);


Symbol of Specifier Meaning of Specifier

/t Used by a program for tab space (it is equivalent to a total of 8 spaces)

/n Used by a program for a new line (it is also known as a linefeed return)

Structure of c program with example


/** //Documentation

* file: age.c

* author: you

* description: a program to find our age.

*/

#include <stdio.h> //Link

#define BORN 2000 //Definition

int age(int current); //Global Declaration

void main() //Main() Function

int current = 2021;

printf("Age: %d", age(current));

getch();

int age(int current) { //Subprograms

return current - BORN;

You might also like