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

MSAT (1) Question Bank

Uploaded by

dofat94986
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

MSAT (1) Question Bank

Uploaded by

dofat94986
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

QUESTION BANK

Subject Code: UGCA 1903

Subject Name: Problem Solving using C

2 / 4 MARKSQUESTION

1. What do you understand by constant ,variables

A constant is a value that remains unchanged throughout the execution of a program or


within a mathematical expression. For example, in programming, PI = 3.14159 is a
constant.

A variable is a value that can change during the program’s execution or in a mathematical
expression. It is used to store data that may vary. For example, in programming, radius = 5
is a variable, as its value can change.

2. Difference between constant and variable

1.Value

 Constant: The value remains **unchanged** throughout the program or


mathematical expression.
 Variable: The value can **change** during the program’s execution or within a
mathematical equation.

2.Usage

 Constant: Used for fixed, known values (e.g., `PI = 3.14159`).


 Variable: Used for values that may vary or depend on conditions (e.g., `radius = 5`).

3. Define bit.
A bit (short for binary digit) is the smallest unit of data in computing. It can represent one of
two possible values: 0 or 1. These binary values are used to encode information in digital
systems, and all data in computers, including numbers, text, images, and more, is ultimately
represented as a sequence of bits.

In summary:

 A bit is the basic unit of information in a computer system.


 It can have two possible values: 0 or 1.

4. Define byte.
A byte is a unit of digital information that consists of 8 bits. It is commonly used to represent a
single character of text, such as a letter or number, in computer systems and can store 256
distinct values (from 0 to 255).

Key Points:

 Size: One byte equals 8 bits.


 Data Representation: A byte can represent 256 distinct values (from 0 to 255), which is
used to store a variety of data types, including characters, integers, or binary data.
 Common Use: In most systems, a byte is used to represent a character in text (e.g., 'A' is
represented by the byte 01000001 in ASCII) or a small integer.

Example:

 In ASCII encoding, the letter 'A' is represented as the byte 01000001.


 A file size or memory size is often measured in bytes (e.g., kilobytes, megabytes).

5. What do you understand by library functions

ibrary functions are pre-written, reusable functions provided by a programming language's


standard library or external libraries. They perform common tasks, such as mathematical
operations, input/output handling, or string manipulation, allowing programmers to use them
directly in their code without writing them from scratch.

Key Points:

 Predefined: Library functions are already implemented and packaged in libraries that
come with the programming language.
 Reusable: They are designed to be reused in multiple programs.
 Examples: Functions like printf() and scanf() in C, sqrt() for square roots in
Python, or len() for getting the length of a string in Python.

#include <math.h>

#include <stdio.h>

int main() {

double result = sqrt(16.0); // Library function to calculate square root

printf("The square root of 16 is: %f\n", result);

return 0;

}
6. Define keywords

Keywords are reserved words in a programming language that have a predefined meaning and
cannot be used as identifiers (such as variable names or function names). They are part of the
syntax of the language and are used to define the structure or control the flow of a program.

auto break case char const continue default do


double else enum extern float for goto if
inline int long register restrict return short signed
sizeof static struct switch typedef union unsigned void

7. Illustrate flowchart

A flowchart is a diagrammatic representation of a process or algorithm, using different shapes


to represent various steps and arrows to show the flow of the process.

You might also like