0% found this document useful (0 votes)
8 views4 pages

cse-1101-common-definitions-from-previous-exam

The document provides a comprehensive overview of fundamental concepts in C programming, including data types, identifiers, keywords, strings, variables, functions, library functions, tokens, and the differences between compilers and interpreters. It also covers advanced topics such as polymorphism, inheritance, operators, pointers, and arrays. Each concept is defined with examples and explanations of their significance in programming.
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)
8 views4 pages

cse-1101-common-definitions-from-previous-exam

The document provides a comprehensive overview of fundamental concepts in C programming, including data types, identifiers, keywords, strings, variables, functions, library functions, tokens, and the differences between compilers and interpreters. It also covers advanced topics such as polymorphism, inheritance, operators, pointers, and arrays. Each concept is defined with examples and explanations of their significance in programming.
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/ 4

Page |1

CSE-1101
Common questions (Definition) from previous exams:

1. Describe Data Types used in C with memory requirements.


C89 defines five foundational data types: character, integer, floating-point, double floating-
point, and valueless. These are declared using char, int, float, double, and void,
respectively.
Memory requirements: The size and range of these data types may vary among processor
types and compilers. However, here are the general memory requirements for them.
i. char – 8 bits
ii. int – 16/32 bits
iii. float – 32 bits
iv. double – 64 bits
v. void – 0 bit
2. What is Identifier? Write down the rules of using a valid Identifier.
In C, the names of variables, functions, labels, and other user-defined items are called
identifiers.
Rules of using valid Identifier:
i. The first character must be a letter or an underscore.
ii. Subsequent characters must be either letters, digits, or underscores.
iii. In an identifier, upper- and lowercase are treated as distinct.
iv. An identifier cannot be the same as a C keyword and should not have the same name
as functions that are in the C library.
3. What is Keyword? Write down any six keywords used in C
Keywords are predefined, reserved words in C language and each of which is associated
with specific features. These words help us to use the functionality of C language. They
have special meaning to the compilers. There is a total of 32 keywords in C.
Here are six of them:
i. int
ii. float
iii. double
iv. if
v. goto
vi. for
4. What is String?
A string is a set of characters enclosed in double-quotes. For example, ''this is a test" is a
string.

--KN--
Page |2

5. Define Variable, Expression, Statement, and Symbolic constant with the declaration.
i. Variable: A variable is a named location in memory that is used to hold a value that
can be modified by the program. All variables must be declared before they can be
used.
ii. Expression: An expression is a formula in which operands are linked to each other
by the use of operators to compute a value. In other words, expression in C is any
valid combination of Operators, constants, functions, and variables.
iii. Statement: A statement is a part of program that can be executed. That is, a statement
specifies an action.
6. Define Function. Why is Function used in C?
A function is a block of statements that performs a specific task.

Why Functions are used in C: Generally, Functions are used for: -


i. Avoid repetition of codes.
ii. Increases program readability.
iii. Divide a complex problem into simpler ones.
iv. Reduces chances of error.
v. Modifying a program becomes easier by using function.

7. Define Library Function with examples.


Library functions are built-in functions that are grouped together and placed in a common
location called library.
Example:
Function Library
printf stdio.h
scanf stdio.h
tan math.h
sin math.h
time time.h

8. What are C tokens?


In C programs, each word and punctuation are referred to as a token. C Tokens are the
smallest building block or smallest unit of a C program.
or
Tokens are the smallest elements of a program, which are meaningful to the compiler.
The following are the types of tokens: Keywords, Identifiers, Constant, Strings,
Operators.

--KN--
Page |3

9. Distinguish between Compiler and Interpreter.


Compliers and interpreters are programs that help convert the high level language into
machine codes to be understood by the computers.
Difference between Compiler and Interpreter:
Compiler Interpreter
1 Translates the entire program into Translates one statement of the program at
machine code at once. a time.
2 Takes a lot of time to analyze the Takes very less time to analyze the source
source code but the overall time to code but the overall time to execute the
execute the process is much faster. process is much slower.
3 Generates an intermediary code. Does not generate an intermediary code.
4 Used by C, C++ etc. Used by Ruby, Python etc.

10.Define Programming Language and Machine Language.


Programming language: A programming language is a set of commands, instructions, and
other syntax uses to create a software program.
Machine language: Machine language is a low-level programming language consisting of
binary or hexadecimal instructions
which a computer can respond to directly.
11.What is Polymorphism?
Polymorphism is reusing a single code multiple time. More specifically, it is the ability of
a program to process objects differently depending on their data type or class.
12.What is Inheritance?
In C++, inheritance is a process in which one object acquires all the properties and
behaviors of its parent object automatically.
13.Discuss the Operators used in C.
An operator is a symbol that tells the compiler to perform a certain mathematical or
logical operation.
Operators are used in programs to manipulate data and variables.
There are a number of operators used in C.
Example:
• Arithmetic operator – used for mathematical operation (+ , − , ∗ , /).
• Relational operator – used for relational operation (< , > , ==)
• Logical operator – used for logical operation (&& , || , !)

--KN--
Page |4

14.What is C? Explain/Write down the structure of C.


C is a high-level programming language. It was developed by Dennis Ritchie in 1970 at
Bell Labs. C is ideal for developing firmware or portable applications.
Structure of C:
1. Documentation section
2. Link section
3. Definition section
4. Global Declaration section
5. Main section
6. Sub program section
15.What is Pointer? And what is Pointer’s pointer?
A pointer is a variable that holds a memory address. This address is the location of
another object (variable) in memory.
Pointer’s pointer: A pointer to a pointer is a form of multiple indirections or a chain of
pointers. Normally, a pointer contains the address of a variable. When we define a pointer
to a pointer, the first pointer contains the address of the second pointer, which points to
the location that contains the actual value
16.What is Array? Store a string called “Engineering” in a one-dimensional character array.
An Array is a collection of variables of the same type that are referred to through a
common name. A specific element in an array is accessed by an index. In C, all arrays
consist of contiguous memory location.

--KN--

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy