You are on page 1of 30

FCI

CSC 202

C PROGRAMMING

ASSEMBLED QUESTIONS

BY

KISMET

TESTIMONY

SIEG

ADEDEJI

DAVID

CHRISTOPHER

RAHMLAD
CHAPTER 1

INTRODUCTION AND HISTORY

1. C programming is created by _____

ANS – Dennis Ritchie

2. C programming is created in the year ___

ANS --- 1972

3. C programming was created at the ______

ANS – BELL Laboratory

4. C programming language was created from ______, ____ and ____

ANS --- ALGOL, BCPL and B programming languages

5. C is a powerful language which is strongly associated with


____ operating system

ANS --- UNIX

6. _____ defined a commercial standard for C

ANS --- ANSI(American National Standards Institute)

7. The commercial standard was defined for C language in the


year ____

ANS --- 1989

8. Other languages such as C++ and Java are developed from C.


True or False

ANS – True

9. KISS stands for _____

ANS --- Keep it Simple and Stupid

10. DRY stands for _____


ANS – Don’t Repeat Yourself

11. C is a compiled language. True or False

ANS --- True

12. ____ is a special tool that compiles the program and


converts it to the object file which is machine readable

ANS --- Compiler

13. MinGW stands for _____

ANS --- Minimalist GNU For Windows

14. Clang, portable ‘c’, Turbo C are popular compilers available


online. True or False

ANS --- True

15. ____ is machine independent structured and a general purpose


programming language that is extremely popular, simple and
flexible

ANS --- C
CHAPTER 2

CONSOLE INPUT/OUTPUT FUNCTIONS

1. The screen and keyboard together are called ____

ANS --- A Console

2. Console I/0 functions can be classified into ____ and ____


console I/O functions

ANS --- Formatted, Unformatted

3. Formatted output is done using ____ function

ANS ---- printf() function

4. The format specifier used for printing an integer number is


____

ANS ---- %nd

5. From Q4, n specifies ____

ANS ---- The minimum field width for the output

6. The format specifier used to display real number in floating


point notation with decimal is ____

ANS ---- %n.df

7. ____ is the name given to backslash constants that are


available in C

ANS ---- Escape sequence

8. ‘\a’ backslash constants describes ______

ANS ---- Bell

9. ‘\r’ describes ____

ANS ---- Carriage return

10.Format specifier consist of ____, type specifier and an


optional number

ANS ---- Conversion character ‘%’

11.‘format specifiers’ and variable list is separated by ____

ANS ---- Commas

12.____ is used to get a character from console but does not echo
to the screen

ANS ---- getch()


13.____ is used to clear the output screen(console)

ANS ---- Clrscr()

14.____ will cause the cursor on the screen to move to the


beginning or the next line

ANS ---- putchar(‘\n’)

15.____ is a file containing C declaration and micro definitions


to be shared between several source files

ANS ---- Header file

16.____ declare the interface to parts of the operating system

ANS ---- System header file

17.Declarations for interfaces between the source files of your


program are contained where

ANS ---- Your own header file

18.Header files serves only two purposes of the system header


files and your own header files. TRUE OR FALSE

ANS ---- True

19.____ is the name of a file in which the functions are stored

ANS ---- File-name

20.After the main function has been declared, the next is ____

ANS ---- specifying the opening and closing parentheses

21._____ indicate the starting and end of a program


ANS ---- Curly bracket {}

22.____ determines the end of the statement

ANS ---- Semi colon


CHAPTER 3

COMMENT IN C PROGRAMMING

1. The two(2) types of comments are ____ (Single Line Comments


and Multi-Line Comments)

2. Single Lines are represented by double slash //

3. Multi-Line comments are represented by slash asterisk


(/...../)

4. %d is used to____?

Ans: print the signed integer

5. %u is used to____?

Ans: print the unsigned integer value where the unsigned


integer means that the variable can hold only positive value.

6. %f is used for___?

Ans: printing the decimal floating-point values.

7. %o is used for___?

Ans: printing the octal unsigned integer where octal integer


value always starts with 0 value

8. Comments affect a Program(True or False)?

Ans: False (because the compiler ignores them)

9. %x is used for___?

Ans: printing the hexadecimal unsigned integer where the


hexadecimal integer value always starts with a Ox value

10. %e or %E is used for____?

Ans: denoting scientific notation


CHAPTER 4

C TOKENS AND DATA TYPES

1. ____ is the smallest unit in a 'C' Program?

Ans: Token

2. Token is divided into __

Ans: 6

3. How many keywords are present in 'C'?

Ans: 32

4. The following are special characters in 'C' except?

A. ;

B. ~

C. $

D. ¿

Ans: D

5. /(forward slash) and /(Division) belongs to _____ in 'C'?

Ans: special characters

6. Which is one a data type in 'C'?

A. Primitive Data type

B. Interactive Data type

C. Derived data type.

D. User-defined Data type

Ans: C
7. Which void type represents the address of an object but not its
type?

A. Function returns as void

B. Function arguments as void

C. Pointers to void

Ans: C

8. Which is a misc operator?

A. =

B. &

C. ^

D. <<

Ans: B

9. 021, 033, 046, etc. are examples of___?

A. Decimal constant

B. Octal constant

C. Character constant

D. Strung Constant

Ans: B

10. ____ is an identifier to store some value

Ans: Variable

11. Which one the following is not a keyword in 'C'?

A. extern

B. static

C. make
D. switch

Ans: make

12.An unsigned char can take a range of what numbers from____?

Ans: [0-255]

13. There are ___ total keywords in C

Ans: 32

14. There are ____ alphanumerical characters that represents the


identifiers in C

Ans: 52

15. Keywords are written in ____ letters

Ans: lowercase

16. Alphanumeric characters includes both uppercase and lowercase.


True or False

Ans: True

17. The 10 numeric digits that also represent the identifiers


ranges from ____ to ___

Ans : [0-9]
CHAPTER 5
CONDITIONAL STATEMENTS
1. Decision making statements are also called ____

ANS ---- Control Statements

2. Conditional statements are possible with the help of ____ and


______ constants

ANS ---- If and If-else statements

3. ____ statement is responsible for modifying the flow of


execution of a program

ANS ---- If Statement

4. If statement evaluates to either ____ or ____

ANS ---- True or False

5. ____ is always a non-zero value

ANS ---- True

6. ____ is a value that contains zero

ANS ---- False

7. Instructions can be a single or a block of code enclosed by


____

ANS ---- Curly brackets {}

8. C has how many relational operators that can be used to


formulate a boolean expression

ANS ---- 6(SIX)

9. The if-else statement is an extension version of _____

ANS ---- If

10. In if-else statement, the true block of statement will be

executed only if ____

ANS ---- The value of test expression is true

11. Usage of multiple if-else constructs within each other is


referred to as _____

ANS ---- Nesting of if-else statement

12. Another way to express an if-else statement is by ______

ANS ---- Introducing the ?: operation


CHAPTER 6
LOOPS
1. In ____, a program executes the sequence of statements many
times until the stated condition becomes false

ANS --- Looping

2. The parts of loop includes ____ and ____

ANS --- Body of a loop and a control statement respectively

3. In which loop is the condition checked before executing the


body of the loop?

ANS --- Entry controlled loop/ Pre-checking loop

4. A loop is classified into ___ and ___

ANS --- Entry controlled loop and Exit controlled loop

5. In which loop is the condition checked after executing the


body of the loop?

ANS --- Exit controlled loop/ post–checking loop

6. The loop that does not stop executing and processes the
statement number of times is called

ANS --- Infinite loop/endless loop

7. In infinite loop, no termination condition is specified and


the specified condition never met. True or False

ANS – True

8. ____ determines whether to execute the loop body or not

ANS --- Specified condition

9. A while loop is the most straightforward looping structure.


True or False

ANS --- True

10.While loop is an entry controlled loop. True or False

ANS --- True

11.Do-while can also be called exit controlled loop. True or


False

ANS --- True


12.In while loop, the while loop is written where?

ANS --- At the beginning

13.In do-while loop, the while is written where?

ANS --- At the end and terminates with a semi colon ;

14.In for loop, the condition is performed how many times?

ANS --- Only once

15.In for loop, the ___ is a boolean expression that tests and
compares the counter to a fixed value after each iteration,
stopping the for loop when false is returned

ANS --- The condition

16.In for loop, the incrementation / decrementation(increase or


decrease) the counter by ______

ANS --- Set value

17.Loop can also be nested where there is ___ and ___

ANS --- An outer loop, inner loop

18.The break statement is used mainly in the switch statement.


True or False

ANS --- True

19.We can use break statement also for immediately stopping of a


loop. True or False

ANS --- True


20.When you want to skip to the next iteration but remain in the
loop, you use the _____ statement

ANS --- Continue


CHAPTER 7
SWITCH CASE STATEMENT
1. A ____ statement tests the value of a variable and compares
it with multiple cases

ANS --- Switch statement

2. Each case in a block of a switch has a different name/number


which is referred to as ___

ANS --- An identifier

3. In C, we can have an inner switch embedded in an outer


switch. Yes or No

ANS --- Yes

4. The one potential problem with the if-else statement which is


the complexity of the program increases whenever the number
of alternative path increase can only be solved by ___

ANS --- Switch statement

5. In switch case, the ___ keyword must be present in each case

ANS --- The break keyword


CHAPTER 8
ARRAYS
1. ____ and ___ of an array cannot be changed once it is declared
ANS ---- Size, Type respectively
2. _____ assigns a numeric reference value to every individual
memory location of an array
ANS ---- Compiler
3. From Question 2, the reference number is called _____
ANS ---- Index or subscript or indices
4. Array elements are accessed by using ____
ANS ---- Integer or array index
5. ____ is also a pointer to the first element of an array
ANS ---- Name of the array
6. ____ are used to store list of values of same datatype
ANS ---- Single dimensional array
7. Single dimensional array can also be called ______
ANS ---- One dimensional or linear or 1D array
8. Array created with more than one dimension is called
ANS ---- 2D or 3D or 4D(dimensional array) or more
9. The most popular and commonly used multi-dimensional array is
ANS ---- 2D Array
10. ___ array are used to store data in form of table and for
creating mathematical matrices
ANS ---- 2D Array
CHAPTER 9
STRINGS
1. _______ is a collection of characters in a linear sequence.
Answer: String
2. A string is represented using ______ quote marks
Answer: double
3. C standard library that contains functions that can be used
to perform complicated string operations easily is what?
Answer: library
4. To make/create a string, you need to make use of the _______
Answer: Character Array
5. The general syntax for creating a string is ________
Answer: char string_variable_name[array_size]
6. scanf function can’t read an entire string
Answer: True
7. In order to read a string that contains white spaces, we use
the ______ function
Answer: gets() function
8. What function reads a specified number of characters and also
an alternative to gets()?
Answer: fgets()
9. The function used to convert string to the equivalent int
value is?
Answer: int atoi(str)
10.The function used to convert string to the equivalent
double value is?
Answer: int atof(str)
11. The function used to convert string to the equivalent long
integer value is?
Answer: int ato(str)
12. When converting a string to any of the types of
number(integer, floats, double, long integer), ____ is
returned if the first character is a not a number or no
numbers are encountered?
Answer: 0

13. A string pointer declaration cannot be modified as it is a


constant.
14. What is stdin?
Answer: It means Standard Input from the keyboard
15. What is stdout?
Answer: It means Standard Output which refers to the console
or screen
16. The fputs functions is used to print/display a string using
the name of the string and a pointer to where you want to
display the text(stdout)
17. strlen() is used for?
Answer: Used for finding a length of a string
18. strcat(str1, str2) is used for?
Answer: Used to concatenate or add two strings together
19. strcmp(str1, str2) is used to?
Answer: Compare two strings with each other
20. strlen(), strcmp(), strcat() are functions that can only be
used with what header file?
Answer: <string.h>
CHAPTER 10
STORAGE CLASSES
1. What is another name for scope level?
ANS ---- Visibility Level
2. Storage class is used to ________
ANS ---- represent information about a variable
3. How many types of standard storage class?
ANS ---- 4
4. Variables defined using automatic storage class are called
_____
ANS ---- Local variables
5. What is used to describe the lifespan of a variable?
ANS ---- Storage class
6. A storage class represents the _____ and _____ of a variable
ANS ---- Visibility, location
7. What is the storage class used to define a global variable?
ANS ---- extern
8. By default, what storage class is a variable in?
ANS ---- auto
9. Can a variable associate with a storage class? True or False
ANS ---- True
10. _____ is used when we have global variables or functions
which are shared between two or more files
ANS ---- external storage class
11. Keyword “extern” stands for ______
ANS ---- external storage class
12. An auto variable contains a _____
ANS ---- garbage value
13. What is used to start, end and identify a bloack of code?
ANS ---- { } or curly braces
14. ____ is used to define a global variable
ANS --- extern
15. What keyword is used to define an auto storage class?
ANS ---- auto
16. Auto variables are limited to the block they were defined in.
True or False
ANS ---- True
17. A auto variable can be accessed outside the block it is
declared in? True or False
ANS ---- False
18. ____ returns and stores its value between blocks and remains
visible only to the block it was defined
ANS ---- Static local variable
19. Another name for function calls is ____
ANS ---- Blocks
20. _____ has a default initial value zero
ANS ---- Static Variables
21. How many times are static variables initialized?
ANS --- Once
22. Variables visible only to the file it is declared in are
_____
ANS ---- Static global variables
23. Are global variables defined before the program start
(main())?
ANS ---- Yes
24. Global variables are accessible throughout the program? True
or False
ANS --- True
25. Variables defined using extern keyword are called ____
ANS ---- Global variables
26. What keyword makes it possible to access a already defined
variable in another file into the current file?
ANS ---- Extern
27. Where are register variables declared?
ANS ---- Beginning of a program
28. Register storage class has no ____
ANS ---- Default value
29. “register storage class” is similar to “auto storage class”
in terms of ____
ANS ---- Lifespan
30. RAM is also called ____
ANS ---- Main memory
31. “Register” is used so as to have ____
ANS ---- Quick access to variables stored
32. How do you declare a register storage class?
ANS ---- Keyword “register”
33. Where do register storage class store local variables?
ANS ---- CPU registers
34. Global variables are accessible throughout the file? True or
False
ANS ---- True
35. Static variables are accessible throughout the file? True or
False
ANS ---- False
CHAPTER 11
FILES
1. What function returns the current position of a file pointer?
ANS --- ftell()
2. “Writing to a file” is one of the file management functions
ANS ---- True
3. ______ is one of file management functions
ANS --- Opening of a file
4. fprintf() writes a ______ to a file
ANS ---- Block of data
5. ______ function closes a file
ANS ---- fclose()
6. Creating or Opening of existing file is defined or done with
____ function
ANS ---- fopen()
7. ____ is used to store a large volume of persistent data
ANS ---- Files
8. ____ standard function is used to open a file
ANS ---- fopen()
9. FILE syntax is a already defined data structure in the standard
library? True or False
ANS ---- True
10. ____ function reads a block of data from a file
ANS ---- fscanf()
11. rewind() function sets the file pointer at the _____
ANS ---- Beginning
12. ____ function writes an integer to a file
ANS ---- putw()
13. ____ function reads a single character from a file
ANS ---- getc()
14. ____ syntax is used to create a file in C
ANS ---- FILE *fp or FILE *(file_pointer)
15. Is “closing a file” a file management function?
ANS ---- Yes
16. ‘W’ mode creates a new file if file doesn’t already exist
ANS ---- True
17. Data is deleted if a file opened in write mode already exists
on a system. True or False
ANS ---- True
18. ____ mode is used to write or input data to a file
ANS ---- ‘W’ or Write mode
19. Data is deleted if a file opened in read mode is already
present on a system. True or False
ANS ---- False
20. ____ mode is used to open a file for reading
ANS ---- ‘R’ Or Read mode
21. A ____ is used to specify what you want to do the file
ANS ---- mode or file mode
22. A file is opened directly with fopen() if it’s already present
in the system. True or False
ANS ---- True
23. fopen() creates and then open a new file if file is not on the
system. True or False
ANS ---- True
24. Can a file save path be specified manually?
ANS ---- Yes
25. Syntax for closing a file is ____
ANS ---- fclose() or fclose(file_pointer)
26. Strings are indicated or created with ____
ANS ---- “ “ or double quotes
27. Extension for file is ____
ANS ---- .txt
28. ____ mode opens file for reading and writing, appending a file
ANS ---- A+
29. ____ mode overwrites a file
ANS ---- ‘W+’
30. ____ mode opens a file for reading and writing from beginning
ANS ---- ‘R+’
31. ____ function returns the next character from the file pointed
to by the file pointer
ANS ---- fgetc()
32. fputs() writes a string to the file pointed to by file
pointer. True or False
ANS ---- True
33. ____ function prints a string to the file pointed by the file
pointer
ANS ---- fprintf()
34. ____ function writes a character to a file pointed to by file
pointer
ANS ---- fputc()
35. ____ must be added when you write a file
ANS ---- \n or newline characters
36. What is returned if closing of a file is successful?
ANS ---- 0
37. What is returned if an error occurred while closing of a file?
ANS ---- EOF(end of file)
38. fclose function takes a ____ as an argument
ANS ---- file pointer
CHAPTER 12
MODULAR PROGRAMMING USING FUNCTIONS
1. _____ in programming is a reusable block of code that makes a
program easier to test.
Ans: Function
2. The main() function is a _______ point of a program
(a)starting (b) ending (c) finishing (d) body.
Ans: A
3. In C programming, functions are divided into ____ types (a)1
(b)2 (c)3 (d)4.
Ans: B
4. The difference between the library function and user-defined
function is that we do not need to write code for ____
function. (a) user-defined (b)library (c) both (d) none
Ans: B
5. Header file is always included at the ____ of a program
(a)body (b) beginning (c) ending (d) starting.
Ans: B
6. Printf and scanf are the example of a _____ function.
Ans: Library
7. In _____ function, we have to write the body of a function
Ans: User-defined
8. C programming functions are divided into ____ activities. (a)1
(b)2 (c)3 (d)4
Ans: C
9. ______ means writing a name of a program.
Ans: Function declaration
10. A function declaration is also called Function _____.
Ans: prototype
11. Function declarations are usually done above the ____ function
Ans: main().
12. A function _____ return a value (a)always (b) sometimes (c)
does necessarily (d) does not necessarily.
Ans: D
13. Function _____ means just writing the body of a function (a)
declaration (b)definition (c) call (d)arguments.
Ans: B
14. A body of a function consist of ____ which are going to
perform a specific task.
Ans: statement
15. A function body consist of a single or a ____ of statements
(a) multiple (b) body (c) double (d) none
Ans: Multiple
16. Function ____ is a mandatory part of a function (a)
declaration (b)definition (c) call (d)arguments.
Ans: B
17. A function ____ means calling a function whenever it is
required in a program. (a) declaration (b)definition (c) call
(d)arguments.
Ans: C
18. Function ____ is an optional part in a program (a) declaration
(b)definition (c) call (d)arguments.
Ans: C
19. A function arguments are used to receive the necessary ____ by
function call(a) code (b) program (c) statement (d) value Ans:
D
20. ______ means the visibility of variables within a code of the
program.
Ans: Variable scope.
21. Variables that are declared _____ a function are local to that
block of code (a) inside (b) outside (c)within (d) without.
Ans: A
22. Local variables cannot be referred to ____ of a function. (a)
inside (b) outside (c)within (d) without.
Ans: B
23. Constants declared with a _____ at the top of a program are
accessible from the entire program (a)#define (b)#include
(c)<stdio.h> (d) <conio.h>
Ans: A
24. _____ variables can be accessed anywhere in the program
(a)local (b) global (c) national (d) international
Ans: B
25. A static variables have a _____ scope. (a)local (b) global (c)
static (d) none
Ans: A
26. _____ variable retain its value forever and can be accessed
when the function is re-entered. (a)local (b) global (c)
static (d) none
Ans: C.
27. ________ variable is initialized when declared and needs the
prefix ______ (a)local, local (b) global, global (c) static,
static (d) none
Ans: C
28. ______ function is a function which calls itself and includes
an exit condition in order to finish the ____ calls
(a)repeating, repeating (b)reoccurring, reoccurring (c)
recursive, recursive (d) recurring, recurring.
Ans: C.
29. Recursion works by _____ calls until the exiting condition is
true. (a) heaping (b) stacking (c) clarion (d)answering
Ans: B
30. _________ functions are mostly used for small computations.
(a) internal (b) external (c)inline (d) none
Ans:C.
CHAPTER 13
POINTERS
1. A pointer is a/an ____
Ans: Address
2. ____ is a derived data type that stores the memory address.
Ans: Pointer
3. A ____ can be incremented or decremented
Ans: Pointer
4. The address can be retrieved by putting a/an ____ before the
variable name. (a) Asterisk (*) (b) percent (%) (c) Ampersand
(&) (d) none
Ans: Ampersand (&)
5. If you print the address of a variable to the screen, it will
look like a totally _____ number (a)integer (b) floating point
(c) random (d) even
Ans: C
6. A pointer will store the address of a _____ (a) constant (b)
variable (c) character (d) string
Ans: B
7. _____ is a value stored in a named storage or memory address
(a) constant (b) variable (c) character (d) string
Ans: B
8. ____ is a variable that points to the storage or memory
address of another variable (a) constant (b) pointer (c)
character (d) string
Ans: B
9. Pointer can be named _____ as long as they obey C’s rules
(a)variable (b) constant (c) nothing (d) anything you want
Ans: D
10. The indirection operator _____ declares a pointer (a) Asterisk
(*) (b) percent (%) (c) Ampersand (&) (d) none
Ans: A
11. We initialize a pointer like standard ____ with a variable
address (a) input (b) output (c) variable (d) constant
12. To get the address of a variable we use the ____ operator (a)
Asterisk (*) (b) percent (%) (c) Ampersand (&) (d) none
Ans: C
13. A null pointer always contains a value ____ (a) NULL (b)
undefined (c) 0 (d) false
14. ____ pointer does not have any standard data type (a) NULL (b)
undefined (c) 0 (d) void
15. Which of the following is not a type of pointer (a) complex
(b) far (c) simple (d) near
Ans: C
CHAPTER 14
STRUCTURES IN C PROGRAMMING
1. _________ helps programmers to group elements of different
data types int to single logical unit
Answer: Structures
2. ______ is usually defined at the beginning of a program
Answer: Structure type
3. A memory allocation takes place when a structure variable is
declared
4. Structure elements are accessed using the _____ notation
Answer: Dot notation
5. static struct date order_date = {9, 12, 1995}
static struct date order_date = {9, 12}
What is the type of initialization of structure in second
statement?
Answer: Partial Initialization
6. The keyword used to rename data types is?
Answer: typedef
7. account acct1, *pt1; pt1 = &acct1
In the above statement, the * character and the & character
is used for what?
Answer: The * character in front of p1 is a pointer, and
the & character in from of acct1 is used to pass the address
of acct1 to pt1 (pls note that the address is passed not
the value)
8. ______ is a template used for defining a collection of
variables under a single name
Answer: structure
9. A structure type is usually defined after the _____
statement in a file
Answer: main()
10. When you declare a structure in a file, is there a memory
location?
Answer: No
CHAPTER 15
DYNAMIC MEMORY ALLOCATION
1. When a variable is declared using a basic data type, the C
compiler automatically allocates memory space for the
variable in a pool of memory called the ____
ANS ---- Stack
2. ____ is an aspect of allocating and freeing memory according
to your needs
ANS ---- Dynamic memory allocation
3. Dynamic memory allocation is managed and served with pointers
that point to the newly allocated space of memory in an area
which we call the ____
ANS ---- Heap
4. The automatic memory management uses the ____ and the dynamic
allocation uses the ____ respectively
ANS ---- Stack, heap
5. ____ is used to allocate a block of memory dynamically
ANS ---- Malloc() function
6. ____ function is called to release or deallocate memory
ANS ---- The free() function
7. The malloc function stands for
ANS ---- Memory allocation
8. The calloc() function stands for
ANS ---- Contiguous allocation
9. ____ is used to allocate the memory to complex data
structures such as array & structures
ANS ---- Calloc() function
10. The ____ function is generally more suitable and efficient
than that of the ____ function respectively
ANS ---- Calloc and malloc respectively
11. ____ function expands the current block while leaving the
original content as it is
ANS ---- Realloc() function
12. Realloc() stands for
ANS ---- Reallocation of memory
13. ____ can also be used reduce the size of the previously
allocated memory
ANS ---- Realloc()
14. ____ array allows the number of elements to grow as needed
ANS ---- Dynamic array
15. ____ array is widely used in computer science algorithm
ANS ---- Dynamic array

You might also like