0% found this document useful (0 votes)
9 views125 pages

23UCAFC11 - Unit II

Uploaded by

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

23UCAFC11 - Unit II

Uploaded by

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

Mannar Thirumalai

Subject code: 23UCAFC11

Sl.No Unit

1 I

2 I

3 I

4 I

5 I

6 I

7 I

8 I

9 I

10 I

11 I

12 I

13 I

14 I

15 I

16 I
17 I

18 I

19 I

20 I

21 I

22 I

23 I

24 I

25 I

26 I

27 I

28 I

29 I

30 I

31 I

32 I

33 I

34 I

35 I
36 I

37 I

38 I

39 I

40 I

41 I

42 I

43 I

44 I

45 I

46 I

47 I

48 I

49 I

50 I

51 I

52 I

53 I

54 I
55 I

56 I

57 I

58 I

59 I

60 I
Mannar Thirumalai Naicker College

ubject code: 23UCAFC11

Question

What is the primary use of the C programming


language?
Which of the following is a key advantage of C
programming?
C is known for its:
Which industry heavily relies on C for embedded
systems?
Which of the following is a popular C compiler?

C is considered a _________ programming language.


What is the significance of C in operating systems
development?
The feature of C that makes it suitable for system
programming?
C is often used for developing ________ software.

What does the "C" in C programming stand for?

What is the correct syntax to declare a structure in C?


In C, how do you define a constant value that cannot be
modified?
Which header file should be included for input and
output functions in C?
To execute a C program, what is the minimum required
function?
What is the correct way to initialize an integer variable
'x' with the value 10 in C?
Which keyword is used to break out of a loop in C?
What is the purpose of the 'if' statement in C?
Which operator is used for dynamic memory allocation in
C?
What is the file extension commonly used for C source
code files?
How do you comment out a single line in C to make it
non-executable?
What is a constant in C programming?

Which of the following is not a valid C variable name?

In C, which data type is used to store single characters?


What is the maximum value that can be stored in an
unsigned int data type?
Which keyword is used to define a constant in C?
Which of the following data types has the highest
precision?
What is the size of the 'float' data type in C?

Which operator is used for finding the remainder in C?

What is the value of an uninitialized variable in C?


Which escape sequence is used to represent a newline
character in C?
What is the character set used in the C programming
language?
In C, which of the following is NOT a valid identifier?
Which character is used to indicate the end of a
statement in C?
What is the maximum length of an identifier in C?

Which of the following is a keyword in C?


What is a "token" in C programming?

Which of the following is not a valid keyword in C?


How many keywords are there in the C programming
language?
In C, what is the purpose of the "return" keyword?

What is the purpose of a constant variable in C?


Which of the following is a valid way to initialize a
constant variable in C?
What is the purpose of the assignment operator (=) in C?
What is the result of the following expression: `int x = 5;
x = x + 3;`?
Which operator is used for comparing two values in C?

What does the `+=` operator do in C?


If you want to declare a constant floating-point variable
in C, which data type should you use?
In C, can you change the value of a constant variable
after it has been initialized?
Which of the following is an example of a valid constant
array declaration in C?
What is the result of the expression `5 + 3 * 2` in C?
In C, which operator is used to find the remainder when
dividing two integers?
What is the value of the expression `10 / 3` in C?
Which of the following operators is used to perform
logical AND in C?
In C, what is the operator for incrementing a variable by
1?
What is the result of the expression `5 == 5` in C?
Which operator is used for the bitwise right shift in C?
What will be the output of the expression `sizeof(int)` in
C on a typical 32-bit system?
What is the purpose of the ternary conditional operator
`?:` in C?
What is the result of the following expression: `int x = 5;
x = x - 3;`?
Which of the following is an important requirement of c
programming?
When was C programming developed?
Naicker College

Subject Title: Structured Programming in C

Option A

Web development

High-level abstractions

Slowness in execution

Healthcare

Java Compiler

Low-level

It's not used in operating systems.

Lack of memory management

Word processing

Complex

struct : MyStruct

constant

<stdio.h>

main()

int x = 10;

exit
To declare variables

new

.src

/* This is a comment */
A value that can be changed during program
execution
my_variable

int

32767

var

int

2 bytes

\n

ASCII

my_variable

Period (.)

8 characters

integer
A keyword used to define data types

break

15

To specify the data type of a function

To store values runtime.

const int r = 10;

To declare a variable.

x is 8.

Performs subtraction.

float

Yes

const int numbers[5] = {1, 2, 3, 4, 5};

16

&&

++

TRUE
<<

Bitwise operations

x is 2.

Function

1970
Option B

Game development

Ease of learning

Limited libraries

Automotive

Python Compiler

High-level

It allows for easy web development.

Lack of pointers

Spreadsheet

Computer

structure MyStruct

immutable

<iostream.h>

execute()

x = 10;

quit
To define functions

alloc

.csrc

// This is a comment

A value that cannot be changed during program execution

123_variable

char

65535

define

float

4 bytes

\t

Unicode

_variable

Semicolon (;)

16 characters

real
A sequence of characters representing a single element in
the program
main

12

To indicate the end of a loop

To store values that cannot be modified after initialization

const r = 10;

To compare two values.

x is 5

==

Performs division

double

No

int const[5] = {1, 2, 3, 4, 5};

11

3.333

||

--

0
>>

Assignment

x is 5

Assignment

1971
Option C

System programming

Portability

Speed and efficiency

Fashion

GCC (GNU Compiler Collection)

Middle-level

It provides a graphical user interface.

Direct memory manipulation

Database management

Creative

struct MyStruct

const

<stdlib.h>

start()

x := 10;

continue
To perform conditional execution

malloc

.code

-- This is a comment

A variable with a fixed name

_variable123

float

2147483647

const

double

8 bytes

It is undefined

\r

EBCDIC

123variable

Colon (:)

32 characters

If
An identifier used for loop control

while

45

To exit a function and return a value

To store values with floating

int const r = 10;

To assign a value to a variable

x is 15.

:=

Performs addition with assignment.

const

Only if it's a global constant

const array[5] = {1, 2, 3, 4, 5};

12

3.4

&

+=

1
&

Conditional expressions

x is 15.

Array

1980
Option D

Mobile app development

Visual interface

Complexity in syntax

Agriculture

PHP Compiler

Visual

It helps in managing hardware resources efficiently.

Limited control structures

Power point

Compiled

declare MyStruct

Read only

<conio.h>

run()

set x = 10;

break
To iterate through a loop

allocate

.c

' This is a comment

A variable with a changing data type

variable123

double

4294967295

constant

char

It varies depending on the system

&

-1

\t

ISO-8859-1

variable123

Exclamation mark (!)

There is no maximum length.

float
A reserved word for function declaration

case

33

To define a new variable

To store values with a variable

int r const = 10;

To perform addition

x is 3

!=

Performs multiplication

float const

Only if it's an array

int[5] const = {1, 2, 3, 4, 5};

10

&

/=

0
&&

14

Logical OR

x is 3

Structure

1981
Correct option

c
System programming

c
Portability

c
Speed and efficiency

b
Automotive

c
GCC (GNU Compiler Collection)

c
Middle-level

d
It helps in managing hardware resources efficiently.

D
Limited control structures

C
Database management

B
Computer

C
struct MyStruct

C
const

a
<stdio.h>

A
main()

a
int x = 10;

D
break
C
To perform conditional execution

C
malloc

D
.c

B
// This is a comment

B
A value that cannot be changed during program execution

B
123_variable

B
char

D
4.29E+09

C
const

C
double

B
4 bytes

A
%

C
It is undefined

A
\n

A
ASCII

C
123variable

B
Semicolon (;)

D
There is no maximum length.

C
If
B
A sequence of characters representing a single element in the program

B
main

A
15

C
To exit a function and return a value

B
To store values that cannot be modified after initialization

A
const int r = 10;

C
To assign a value to a variable

A
x is 8.

B
==

C
Performs addition with assignment.

D
float const

B
No

a
const int numbers[5] = {1, 2, 3, 4, 5};

B
11

B
%

A
3

A
&&

A
++

A
TRUE
B
>>

B
4

C
Conditional expressions

A
x is 2.

A
Function

A
1970
Mannar Thirumalai Naicker Col
Subject code: 23UCAFC11

Sl.No Unit

1 II

2 II

3 II

4 II

5 II

6 II

7 II

8 II

9 II

10 II

11 II

12 II

13 II

14 II

15 II

16 II

17 II
18 II

19 II

20 II

21 II

22 II

23 II

24 II

25 II

26 II

27 II

28 II

29 II

30 II

31 II

32 II

33 II

34 II

35 II

36 II
37 II

38 II

39 II

40 II

41 II

42 II

43 II

44 II

45 II

46 II

47 II

48 II

49 II

50 II

51 II

52 II

53 II

54 II

55 II
56 II

57 II

58 II

59 II

60 II
Mannar Thirumalai Naicker College
Subject code: 23UCAFC11

Question

What is the purpose of the `if` statement in C programming?


Which symbol is used to denote equality in a conditional
statement?
In C programming, what will be the result of the expression `5 >
3`?
In C programming, what will be the result of the expression `5<
3`?
What happens if the condition in an `if` statement is false?
In C, which of the following is not a valid data type for conditions
in an `if` statement?
What is the syntax for the `if` statement in C?
Which operator is used to combine multiple conditions in an `if`
statement
What is the purpose of the `else` statement in C programming?
In an `if-else` statement, if the `if` condition is true, what
happens to the `else` block?**
What is the purpose of the "if" statement in C programming?
In C, which symbol is used to denote the "not equal to"
comparison operator?
What does the "else" keyword do in an if-else statement?
Which of the following statements is true about a "nested if"
statement in C?
What is the purpose of the "else if" statement in C?
Which logical operator is used to combine two or more conditions
to produce a single true or false result in C?
In C, how do you create a multi-way decision using the "switch"
statement?
What happens if there is no "break" statement in a "switch" case
in C?
What is the purpose of the "default" case in a "switch" statement
in C?
Which of the following is NOT a valid C programming construct for
decision making?
Which statement is used in C to make a decision based on a
condition?
What is the purpose of the "else" statement in C?

In C, what is the syntax for the "if-else" statement?


In a "switch" statement, what is the purpose of the "break"
statement?
Which statement is used for unconditional branching in C?

What is the purpose of the "goto" statement in C?

Which of the following is NOT a valid use of the "goto" statement?


How can you avoid using the "goto" statement for better code
readability
In a "switch" statement,can be used for the expression inside the
parentheses?
What does the "default" case in a "switch" statement do?

What is the purpose of a while loop in C programming?

Which keyword is used to begin a while loop in C?


What is the minimum number of times the code inside a while
loop will execute
In a while loop, where is the condition typically evaluated?

What happens if the condition of a while loop is never true?

To create an infinite loop in C, which condition should you use?


How do you exit a while loop prematurely in C?

What is the purpose of the "continue" statement in a while loop?


statements is true regarding the initialization of loop variables in
a while loop?
In a while loop, what happens if the condition is initially true?

What is the primary purpose of a do-while loop in C?

In a do-while loop, when is the loop condition checked?

What is the syntax for a do-while loop in C?


How many times will a do-while loop execute if the loop condition
is initially false?
Which of the following statements is true about the do-while loop?

What is the purpose of the "break" statement in a do-while loop?


Which operator is commonly used to update the loop control
variable in a do-while loop?
In a do-while loop, what is the significance of the semicolon at the
end of the loop?
What is an infinite loop?

Which of the following is an example of a valid do-while loop in C?

What is the purpose of a "for" loop in C programming?

Which keyword is used to initiate a "for" loop in C?

How many else if statements can follow a single if statement?

How many essential components are there in a "for" loop header?

Which of the following is not a part of the "for" loop header in C?


What is the purpose of the initialization part in a "for" loop?

In a "for" loop, when is the loop condition checked?

Which statement is used to exit a "for" loop prematurely in C?

What is the purpose of the "continue" statement in a "for" loop?

How is an infinite "for" loop created in C?


ege
Subject Title: Structured Programming in C

Option A

To define a function

==

TRUE

The program terminates

int

if (condition) { code block }

&&

To terminate the program

It is skipped

To declare variables

==

It terminates the program


It cannot contain another "if"
statement
To end the program

&&

By using multiple "if" statements


The program terminates

It is used to specify the first case

if-else statement

for
It represents a loop control
statement
if (condition) { /* code */ } else
{ /* code */ }
It indicates the end of the
program.
continue

It is used to exit a loop.


Jumping to the beginning of a
loop.
Always use "if-else" statements

int
It specifies the final case in the
switch statement
To declare variables

for

Zero times

Before entering the loop

The loop runs indefinitely

TRUE
Use the "break" statement

To exit the loop


Initialization is not necessary for a
while loop
The loop runs once
To execute a block of code at least
once
Before entering the loop

do (condition) { /* code */ } while;

Zero times
It is guaranteed to execute at
least once
To exit the loop prematurely

+-
It separates the loop condition
from the loop body
A loop that runs exactly once

do (x > 5) { /* code */ } while;

To declare variables

while

Only one

one
Initialization
To specify the loop's exit condition

Before the initialization

exit

To terminate the loop

By omitting the loop condition


Programming in C

Option B

To declare a variable

FALSE
The program executes the code block
inside the `if` statement
float

(condition) { code block } if

||

To define a function

It is executed after the `if` block

To perform arithmetic operations

It is used for multiplication

It is used to create loops

To check if a variable is even

||

By using nested "if" statements


It produces an error
It is executed when none of the "case"
conditions are met
switch statement

while

It is used to declare variables.

if { /* code */ } else { /* code */ }


It skips the current case and proceeds
to the next case.
return
It is used to jump to a labeled statement
within the same function
Jumping to a label inside the same
function
Use "switch" statements exclusively

float
It is used to catch any cases that don't
match the other case labels.
To define functions

do

One time

After exiting the loop

The loop runs once

0
Use the "continue" statement
To skip the rest of the code in the loop
and move to the next iteration
Variables are automatically initialized to
0
The loop doesn't run at all
To repeat a block of code while a
condition is true
After executing the loop's body

do while (condition) { /* code */ };

Once
It is never executed if the condition is
false initially
To restart the loop from the beginning

=
It is a syntax error; a semicolon should
not be there.
A loop that never terminates

do { /* code */ } while (x > 5);

To define functions

do

Two

two
Condition
To declare loop control variables

After the initialization

break
To skip the current iteration and
proceed to the next one
By setting the loop condition to "true"
Option C

To perform decision making and branching

!=

Error

Error
The program skips the code block inside the
`if` statement
char

{ code block } (condition) if

!
To specify an alternative code block to
execute when the `if` condition is false
It causes an error.

To make decisions based on conditions

!=
It specifies an alternative action if the "if"
condition is false
It can only have one condition
To provide an alternative condition to check if
the initial if condition is false.
!
By using the "switch" keyword followed by
multiple "case" labels
Execution continues to the next case without
any checks
It is used to create a loop

while loop

if
It is used to specify an alternative action
when the "if" condition is false.
if (condition) then { /* code */ } else { /* code
*/ }
It is used to exit the switch statement and
continue with the code after the switch
goto

It is used to create a new function

Jumping to a label in a different function

Avoid using loops

double

It is used to terminate the switch statement


To repeat a block of code while a condition is
true
while

Indefinitely

Inside the loop body

The program terminates

0
Remove the condition

To reinitialize loop variables

Initialization should be done before the loop

The loop runs indefinitely

To execute a block of code exactly once

Before executing the loop's body

do { /* code */ } while (condition);

Infinite times

It cannot be used in C programming


To skip the current iteration and continue with
the next
++

It terminates the loop prematurely.

A loop that runs a fixed number of times

while { /* code */ } (x > 5) do;

To execute a block of code repeatedly

for

Three

three
Increment
To initialize loop control variables

Before each iteration

continue

To reinitialize loop control variables

By using the keyword "infinite"


Option D Correct option

To create a loop C
To perform decision making and branching

> A
==

8A
TRUE

8B
FALSE
The program prints an error
message
C
The program skips the code block inside the `if` state

string D
string

condition { code block } if A


if (condition) { code block }

% A
&&

To print a message C
To specify an alternative code block to execute whe

It replaces the `if` block. A


It is skipped

To loop through a block of code C


To make decisions based on conditions

<> C
!=

It is used to check for equality C


It specifies an alternative action if the "if" condition
It contains an "if" statement
within another "if" statement
D
It contains an "if" statement within another "if" stat

To compare two strings C


To provide an alternative condition to check if the in

% A
&&

By using the "for" loop C


By using the "switch" keyword followed by multiple
It automatically inserts a break
statement
C
Execution continues to the next case without any ch

It is used to check for equality B


It is executed when none of the "case" conditions ar

for loop C
while loop

do-while C
if
It is used to create a switch
case
C
It is used to specify an alternative action when the "
if (condition) [ /* code */ ] else
[ /* code */ ]
A
if (condition) { /* code */ } else { /* code */ }

It is used to define a new case. C


It is used to exit the switch statement and continue

break C
goto
It is used to switch between
different cases in a switch B
It is used to jump to a labeled statement within the
statement
Jumping to a label in the same
switch statement.
C
Jumping to a label in a different function
Use functions and modular
programming
D
Use functions and modular programming

char A
int

It is not a valid keyword in C. B


It is used to catch any cases that don't match the oth
To perform mathematical
calculations
C
To repeat a block of code while a condition is true

loop C
while

Depends on the code A


Zero times

At the end of the program A


Before entering the loop
The loop executes the else
block
C
The program terminates

1A
TRUE
You cannot exit a while loop
prematurely
A
Use the "break" statement

To check the loop condition B


To skip the rest of the code in the loop and move to
Initialization should be done
inside the loop body
C
Initialization should be done before the loop

The loop runs twice C


The loop runs indefinitely
To repeat a block of code a
specific number of times
A
To execute a block of code at least once

At the end of the loop B


After executing the loop's body
do (condition) while { /* code
*/ };
C
do { /* code */ } while (condition);

. It depends on the loop body B


Once

It is equivalent to a for loop. A


It is guaranteed to execute at least once

To check the loop condition A


To exit the loop prematurely

-- C
++

It signifies the end of the loop. B


It is a syntax error; a semicolon should not be there.

A loop that has no loop body B


A loop that never terminates

(x > 5) do { /* code */ } while; B


do { /* code */ } while (x > 5);
To perform mathematical
calculations
C
To execute a block of code repeatedly

if C
for

As many as needed D
As many as needed

four
C
three

Main code block D


Main code block
To define the loop's body C
To initialize loop control variables

After each iteration C


Before each iteration

return B
break
To print a message to the
console
B
To skip the current iteration and proceed to the nex

By using the keyword "forever" B


By setting the loop condition to "true"
making and branching

he code block inside the `if` statement

tive code block to execute when the `if` condition is false

ased on conditions

ative action if the "if" condition is false

atement within another "if" statement

ative condition to check if the initial if condition is false.

" keyword followed by multiple "case" labels


to the next case without any checks

none of the "case" conditions are met

n alternative action when the "if" condition is false.

de */ } else { /* code */ }

switch statement and continue with the code after the switch

a labeled statement within the same function

a different function

odular programming

y cases that don't match the other case labels.

code while a condition is true


e code in the loop and move to the next iteration

be done before the loop

f code at least once

le (condition);

xecute at least once

semicolon should not be there.

f code repeatedly
trol variables

eration and proceed to the next one

ondition to "true"
Mannar Thirumalai Naic
Subject code: 23UCAFC11

Sl.No Unit

1. III

2. III

3. III

4. III

5. III

6. III

7. III

8. III

9. III

10. III

11. III

12. III

13. III

14. III

15. III

16. III
17. III

18. III

19. III

20. III

21. III

22. III

23. III

24. III

25. III

26. III

27. III

28. III

29. III
30. III

31. III

32. III

33. III

34. III

35. III

36. III

37. III

38. III

39. III

40. III

41. III

42. III

43. III

44. III

45. III

46. III

47. III
48. III

49. III

50. III

51. III

52. III

53. III

54. III

55. III

56. III

57. III

58. III

59. III

60. III
Mannar Thirumalai Naicker College
Subject code: 23UCAFC11

Question

What is the correct way to declare an array of integers named "myArray" with 5 eleme
in C?
How do you declare a character array named "name" with a maximum length of 50
characters in C?

What is the size (in bytes) of an array declared as int myArray[10] in C?

. In C, can you change the size of an array after it has been declared?

Which of the following is a valid way to initialize an array in C?

What is the index of the last element in an array declared as int arr[7] in C?

Which symbol is used to access elements of an array in C?

What happens if you try to access an array element at an index that is out of bounds i
C?

Which of the following is a valid declaration for a 2D array in C?

How do you declare a pointer to an integer array in C?

What is the correct syntax for accessing an element in an array in C?

In C, arrays are indexed starting from:

Which of the following is the correct way to access the first element of an array in C?

What happens if you try to access an array element with an index that is out of bound

How do you access the last element of an array in C, assuming the array has 'n'
elements?

In C, can you use a negative index to access elements from the end of an array?
What is the purpose of bounds checking when accessing array elements?

Which C standard library function can be used to safely copy elements from one array
another, ensuring no buffer overflows occur?
In a multi-dimensional array `arr[m][n]`, how do you access an element at row `i` and
column `j`?

When passing an array as an argument to a function in C, what is actually passed?

How do you initialize a two-dimensional integer array in C?

What is the correct way to initialize a two-dimensional character array with strings in C

How can you initialize a two-dimensional array with all elements set to zero in C?

How do you initialize a two-dimensional array with different values in each row and
column in C?

What is the correct syntax to initialize a one-dimensional integer array in C with three
elements?

How can you initialize all elements of a one-dimensional array of floats to 0.0 in C?

Which of the following is a valid way to initialize a one-dimensional character array in


to store the string "Hello"?

What happens if you don't specify the size of a one-dimensional array during initializat
in C?

Which of the following is a valid way to initialize a one-dimensional array in C with all
elements set to 1?
____ are derived data types in c

Array is an example of _______ type memory allocation.

The information about an array used in program will be stored in

The parameter passing mechanism for an array is

Length of the string "letsfindcourse" is

How do you initialize a two-dimensional array in C with specific values?

What is the correct way to initialize a multi-dimensional array in C?

When initializing a multi-dimensional array, what happens if you provide fewer values
than the array can hold?

How do you initialize a one-dimensional character array (string) in C?

What is the correct way to access an element in a one-dimensional array in C?

In a two-dimensional array `matrix`, what is the correct syntax to access an element a


row 2, column 3?
How do you access an element in a multi-dimensional array in C with dimensions `3x4
at coordinates `(1, 2, 3)`?

To access the first element in a one-dimensional array in C, which index should you us

In a two-dimensional array in C, what does the first index represent?

Given a three-dimensional array `cube` with dimensions `2x3x4`, how would you acce
the element at coordinates `(1, 2, 3)`?
Which of the following is the correct way to access an element in a one-dimensional ar
using a pointer in C?

How would you access the last element in a one-dimensional array `arr` of size `n`?

Which of the following sorting algorithms has an average time complexity of O(n log n
and is often considered one of the fastest sorting algorithms?
In C programming, arrays are zero-indexed. What does this mean?

In C programming, how can you access the third element of an integer array `arr`?

Which function is commonly used in C to compare elements when sorting using the
qsort() function from the C Standard Library?

What is the correct way to declare a 2D array in C to store integers?

How do you access an element in a 2D array with row index `i` and column index `j`?

What is the maximum number of dimensions that a C array can have?

Which of the following is the correct way to initialize a 2D array in C?

What is the index of the last element in a 2D array `arr` with dimensions `M x N`?

In C, what is the storage order of elements in a 2D array?

How do you find the number of columns in a 2D array in C?

``c int arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; printf("%d", arr[1][2]); ```
result

What is the correct syntax for passing a 2D array `matrix` to a function in C?

How do you iterate through all the elements of a 2D array `arr` with dimensions `M x
using nested loops?
Subject Title: Structured Programming in C

Option A Option B

int myArray[5]; int myArray = [5];

char name[50]; char[50] name;

10 20

Yes No

int numbers[5] = {1, 2, 3, 4,


int numbers[5] = {1, 2, 3};
5, 6};

6 7

. ::

The program terminates with an The program continues


error without any issues

int matrix[3, 3]; int matrix[3][3];

int* arrayPtr[]; int arrayPtr*;

array_name[element_index] element_index[array_name]

0 1

array[0] array[10]

The program crashes random value

array[n-1] array[n-11]

Yes No
It increases the program's
It prevents buffer overflows
performance

memcpy() strcpy()

arr[I j] arr[ij)

The address of the first


The entire array
element
`int arr[2][3] = {{1, 2, 3}, {4, 5, `int arr[2][3] = {{1, }, {4,
6}};` 5, 6}};`
`char words[2][10] = {'H',
`char words[2][10] = {"Hello",
'e', 'l', 'l', 'o', '\0', 'W', 'o', 'r',
"World"};`
'l', 'd', '\0'};`

`int arr[2][2] = {0};` `int arr[2][2] = {{0}};`

Use nested loops to assign


two-dimensional array with
values to each element
different values
individually

int arr[3] = {1, 2, 3}; int arr[1, 2, 3];

float arr[] = {0.0}; float arr[0.0];

char str[5] = "Hello"; char str[] = "Hello";

The compiler will


automatically determine the
The array will have a size of 0.
size based on the number of
elements provided.

int arr[1] = {1}; int arr[] = {1, 1, 1};


Arrays Elements

Compile time Run time

Symbol Table Activation Record

call by value call by reference

13 14

int matrix[][] = {{1, 2, 3}, {4, 5, int matrix[3][3] = {1, 2, 3,


6}, {7, 8, 9}}; 4, 5, 6, 7, 8, 9};
int multi[2][3] = {{1, 2, 3}, {4, int multi[2][3] = {{1, 2, 3},
5}}; {4, 5, 6}};
The compiler automatically
It results in a compilation error. fills in missing values with
zeros.
char str[] = "Hello"; char str[5] = "Hello";

array(1) array[1]

matrix(2, 3) matrix[2][3]

array[1][2][3] array(1, 2, 3)

0 1

The column number. The row number.

cube(1, 2, 3) . cube[1][2][3]

*array &array

arr[n] arr[n-1]

Bubble Sort Selection Sort


The first element of the array has The first element of the
an index of 1. array has an index of -1

`arr(2)` `arr[3]`

cmp() compare()

`int array[][];` `int array[rows][columns];`

`array[i, j]` `array[i][j]`

1 2

`int matrix[2][2] = {{1, 2},


`int matrix[2][2] = {1, 2, 3, 4};`
{3, 4}};`

`M-1, N-1` `M, N`

Column-major order Row-major order

`sizeof(array) /
`sizeof(array[0])`
sizeof(array[0])`

2 4

void myFunction(int
void myFunction(int matrix[][])`
*matrix[])`
Two `for` loops with `i` from 0 to Two `while` loops with `i`
M and `j` from 0 to N. and `j` as loop counters.
Option C Option D

int[] myArray = {5}; int myArray{} = 5;

char(50) name[]; name = char[50];

40 30

1 2

int numbers[] = {1, 2, 3}; int numbers[3] = {1, 2, 3, 4};

0 1

; []

The index is automatically


It depends on the compiler
adjusted to a valid value.

int matrix(3)(3); int matrix{3, 3};

int (*arrayPtr)[]; arrayPtr = int*;

element_index++
array_name[element_index]++
[array_name]

-1 2

array[20] array[30]

It can lead to undefined


It returns 0
behavior

array[n+1] array[n+11]

0 1
It helps in dynamic memory It's not necessary in C
allocation programming

strcat() strncpy()

arr[i][j] Arr(i)[j]

A copy of the array The size of the array

`int arr[2][3] = {{1, 3}, {4, 5, `int arr[2][3] = {{1, 2, 3},


6}};` { 6}};`
`char words[][] = {"Hello", `char words[2][10] = {"H",
"World"};` "W"};`

`int arr[2][2] = {{0, 0}, {0,


int arr[2][2] = {0, 0, 0, 0};`
0}};`

`int arr[2][2] = {{1}, {2,


`int arr[2][2] = {1, 2, 3, 4};`
3}};`

int arr[] = {1, 2, 3}; int arr[1] = {1, 2, 3};

float arr[] = {0.0, 0.0, 0.0}; float arr[3] = {0.0};

char str[6] = {'H', 'e', 'l', 'l', char str[5] = {'H', 'e', 'l', 'l',
'o'}; 'o'};

It is not possible to initialize an


The code will result in a
array without specifying the
compilation error
size.

int arr[3] = {1, 1, 1}; int arr[1, 1, 1];


Data String

Both A and B Error

Dope Vector data

call by value-result zero

15 12

int matrix[3][3] = {1, 2, 3, 4,


nt matrix[3][3];
5, 6, 7, 8, 9};
int multi[2][3] = {1, 2, 3, 4, 5, int multi[][] = {{1, 2, 3}, {4,
6}; 5, 6}};
It initializes the array with
A SUM B
random values.

char str[] = {'H', 'e', 'l', 'l', 'o'}; A SUB B

array{1} array|1]

. matrix{2, 3} matrix|2|3|

array{1, 2, 3} array|1|2|3|

-1 2

The depth. The element value.

cube{1, 2, 3} cube|1|2|3|

array* array&

. arr[1] arr[last]

Merge Sort Insertion Sort


The first element of the array The first element of the array
has an index of 0. has an index of 2.

arr[2]` `arr.third`

a custom comparison
strcmp()
function
`int array[] = {rows,
`int array[rows, columns];`
columns};`

array(i, j)` `array(i][j]`

3 There is no maximum limit

int matrix[][] = {{1, 2}, {3, `int matrix[2][] = {1, 2, 3,


4}};` 4};`

`M+1, N+1` `M, N-1`

Random order Depends on the compiler

`array[0].length` `array.length`

6 8

void myFunction(int matrix[] void myFunction(int


[N])` **matrix)`
A single `for` loop with `i`
A single `for` loop with `i` from
from 0 to M and `j` from 0 to
0 to M*N.
N.
Correct option

A
int myArray[5];

A
char name[50];

C
40

B
No

A
int numbers[5] = {1, 2, 3};

A
6

D
[]

A
The program terminates with an error

B
int matrix[3][3];

C
int (*arrayPtr)[];

A
array_name[element_index]

A
0

A
array[0]

D
It can lead to undefined behavior

array[n-1]
A

A
Yes
A
It prevents buffer overflows

A
memcpy()

C
arr[i][j]

B
The address of the first element

A
`int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};`

A
`char words[2][10] = {"Hello", "World"};`

`int arr[2][2] = {{0, 0}, {0, 0}};`


D

Use nested loops to assign values to each element individually


B

A
int arr[3] = {1, 2, 3};

float arr[] = {0.0, 0.0, 0.0};


C

char str[] = "Hello";


B

The compiler will automatically determine the size based on th


B

int arr[3] = {1, 1, 1};


C
Arrays
A

A
Compile time

c
Dope Vector

b
call by reference

b
14

A
int matrix[][] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

B
int multi[2][3] = {{1, 2, 3}, {4, 5, 6}};

B
The compiler automatically fills in missing values with zeros.

A
char str[] = "Hello";

B
array[1]

B
matrix[2][3]

A
array[1][2][3]

A
0

B
The row number.

B
. cube[1][2][3]

A
*array

B
arr[n-1]

C
Merge Sort
C
The first element of the array has an index of 0.

C
arr[2]`

D
a custom comparison function

B
`int array[rows][columns];`

B
`array[i][j]`

D
There is no maximum limit

B
`int matrix[2][2] = {{1, 2}, {3, 4}};`

A
`M-1, N-1`

B
Row-major order

B
`sizeof(array) / sizeof(array[0])`

6
C

C
void myFunction(int matrix[][N])`

A
Two `for` loops with `i` from 0 to M and `j` from 0 to N.
element individually

he size based on the number of elements provided.


values with zeros.
from 0 to N.
Mannar Thirumalai Naicke
Subject code: 23UCAFC11

Sl.No Unit

1 IV

2 IV

3 IV

4 IV

5 IV

6 IV

7 IV

8 IV

9 IV

10 IV

11 IV

12 IV

13 IV

14 IV

15 IV

16 IV

17 IV
18 IV

19 IV

20 IV

21 IV

22 IV

23 IV

24 IV

25 IV

26 IV

27 IV

28 IV

29 IV

30 IV

31 IV

32 IV

33 IV

34 IV

35 IV

36 IV
37 IV

38 IV

39 IV

40 IV

41 IV

42 IV

43 IV

44 IV

45 IV

46 IV

47 IV

48 IV

49 IV

50 IV

51 IV

52 IV

53 IV
54 IV

55 IV

56 IV

57 IV

58 IV

59 IV

60 IV
Mannar Thirumalai Naicker College
ct code: 23UCAFC11

Question

What is a function in C programming?

Which keyword is used to define a function in C?

In C, which of the following is NOT a standard library function?

What is the purpose of a function prototype in C?

What is the main advantage of using functions in C programming?

Which of the following is NOT a valid function name in C?

What is the return type of the main() function in C?

In C, which keyword is used to indicate that a function does not return a value?

When is a function's return statement required in C?

Which C function is automatically called when the program starts execution?

What is the data type of the return value of a function in C?

Which keyword is used to declare a function that does not return any value?

What is the maximum number of values that a C function can return?

Which of the following is NOT a valid return type for a C function?

If a function does not have a return statement, what will be the default return
value?

Which keyword is used to indicate the end of a function and return a value in C?

Which of the following is a valid way to declare a function that returns a floating-
point value?
In C, can a function return an array?

Which category of functions in C programming does not return any value?

Which category of functions in C programming is defined by the user to perform


specific tasks?
Which category of functions in C programming is provided by the C standard
library and can be used without additional declarations?
Which category of functions in C programming is used to manipulate text files,
perform mathematical operations, and other general-purpose tasks?
Which category of functions in C programming is used to perform text substitution
before the actual compilation process?

Which category of functions in C programming is used for macro definitions?

What is a nested function in C programming?**

What is the base case in a recursive function?**

Which of the following is true about recursion in C?**

What is the process by which a recursive function calls itself with smaller or
simpler inputs?**

Which of the following is an advantage of using recursive functions in C?**

In C, what will happen if a recursive function lacks a base case?**

Which of the following statements is true regarding the scope of variables in


nested functions in C?**
What is the main difference between call by value and call by reference in C
programming?

Which keyword is used to pass arguments by reference in a C function?

In a call by value function, can the function modify the original value of the
argument passed?

In a call by reference function, what is passed to the function?

What is the purpose of using call by reference in C programming?


Which type of function parameter passing is more efficient in terms of memory
usage?

In C, which of the following data types is typically passed by reference?

When using call by reference, which operator is used to access the value stored at
a memory address?

What is a character array in C?**

Which library function is used to input a string from the standard input in C?**

What is the null character in C?**

What is the purpose of the `strlen()` function in C?**

Which standard library function is used to compare two strings in C?**

What is the maximum number of characters a string can hold in C?**

Which function is used to copy one string into another in C?**

In C, how do you declare a character array named "myString" with a size of 20


characters?**

What is the return type of the `strcat()` function in C?**

Which function is used to convert a string to an integer in C?

An array can be initialized either at compile time or at_______

Which array that uses more than two subscripts?

How many parts are consists in Function header?

______is the process of arranging the elements of an array in order.


Leta[5]={‘I’,’n’,’d’,’i’,’a’}.

What is the value of a[3] ?

Disadvantage of array in C is

What is right way to initialize array?

An array elements are always stored in________memory locations.

Array can be considered as set of elements stored in consecutive memory


locations but having __________.

What is the value of an array element which is not initialized

What happens when you try to access an array variable outside its size
Subject Title: Structured Programming in C

Option A Option B Option C

A reusable block of
A variable A statement
code

func def fun

printf() scanf() myFunction()


It provides the
It defines the function's It is not required in
function's
name and return type. C.
implementation.
They reduce code They make the They allow you to
redundancy. code run faster. use any data type.

my_function 123function calculateSum

int void char

empty null void


Only for functions
Only for functions with For all functions
with a return type
a return type of int that return a value.
of void
main() start() execute()

void int float

none null empty

One ) Two Three

int float double

0 1 -1

end finish return

float myFunction(); void myFunction(); int myFunction();


Yes No 0

Void functions Standard functions Library functions

Preprocessor functions Standard functions Library functions

Preprocessor functions Standard functions Library functions

Preprocessor functions Standard functions Library functions

Preprocessor functions Standard functions Library functions

Preprocessor functions Standard functions Library functions


A function that is called A function defined A function with
from within another inside another multiple return
function function
A case where the statements
The terminating
The initial case where
function calls itself condition that
the function starts Recursion can lead
Recursion is always again stops recursion
Recursion is not to a stack overflow
more memory-efficient
supported in C if not handled
than iteration
properly
Backtracking Iteration Tail recursion
Improved performance Lower memory
Simplicity in solving
compared to iterative usage compared to
complex problems
solutions The function will iteration
The function will
The function will run
throw a compilation
Variables in the return a random
infinitely
Variables in the outer Variables in the
error
inner function value
function cannot
Call by value be a Call by value allows
passes outer function can
cannot be accessed
accessed byactual
copy of the the inner you to change the be
Callaccessed by the
by reference is
by the outer
function
parameter, while call value of the actual inner function
the same as call by
function
by reference passes parameter, while value, but with a
the actual parameter call by reference different name.
ref
itself. value
does not. pointer
Yes, the function can No, the function It depends on the
modify the original cannot modify the function's
value. original value.
The memory implementation.
A copy of the A pointer to the
address of the
argument's value. argument.
argument.
To allow functions
To reduce memory To make the code
to modify the
usage. more readable.
original data.
Both are equally
Call by value Call by reference
efficient.

int float struct

* & ->

An array of floating- An array of


An array of integers
point numbers characters

gets()` `scanf()` getchar()`

\0' '\n' '\r'

To concatenate two To find the length


To compare two strings
strings of a string

strcat()` `strcmp()` `strlen()`

256 512 1024

`strcat()` `strcmp()` `strlen()`

`char myString = `char myString[] =


char myString[20];`
"20";` "20";`

`int` `char*` `void`

`atoi()` `itoa()` `strtoi()`

end of time execution time run time

one dimensional multi dimensional two dimensional

one two three

searching sorting aligning


i n d

it is necessary to it can store only


we can easily access
declare too many one similar type of
each element
variables data
int
int n{} = { 2, 4, 12, int n{6} = { 2, 4,
num[6]={2,3,12,45,5,6
5, 45, 5 }; 12 };
}
sequential &
sequential random
random

same data type different data type same scope

Depends on
0 1 storage class
some garbage value
will be return 1 11
Option D Correct option

A data type C
A reusable block of code

int D
int

strlen() C
myFunction()
It defines the
A
main() function. It defines the function's name and return type.
They remove the
need for a main() A
function. They reduce code redundancy.

print_hello B
123function

double A
int

none C
void
It is never
C
required. For all functions that return a value.

program() A
main()

char B
int

void D
void

Unlimited A
One

string D
string
) It will produce a
A
compilation error 0

exit C
return

char myFunction(); A
float myFunction();
1B
No
User-defined
A
functions Void functions
User-defined
D
functions User-defined functions
User-defined
B
functions Standard functions
User-defined
C
functions Library functions
User-defined
A
functions Preprocessor functions
User-defined
A
functions Preprocessor functions
A function that can
only be called B
recursively A function defined inside another function
A case where the
function returns a C
non-zero The terminating condition that stops recursion
Recursionvalue
can only
be used with C
nested functions Recursion can lead to a stack overflow if not handled

Divide and conquer A


Backtracking
Ability to handle
any problem B
without limitations Simplicity in solving complex problems
The function will
A
return 0 by default The function will run infinitely
Variables in nested
functions have
Call by value is C
global scope Variables in the outer function can be accessed by th
used for primitive
data types, and A
call by reference is Call by value passes a copy of the actual parameter,
used
& for objects D
&
Only if the
argument is a B
pointer. No, the function cannot modify the original value.
The argument
B
itself. The memory address of the argument.
To pass data as a
copy, ensuring B
data integrity. To allow functions to modify the original data.
It depends on the
size of the data A
being passed. Call by value

char C
struct

:: A
*
An array of
C
pointers An array of characters

`read()` A
gets()`

'\t' A
\0'
To convert a string
C
to uppercase To find the length of a string

`strcpy()` B
`strcmp()`
It depends on the
D
available memory It depends on the available memory

`strcpy()` D
`strcpy()`
`char[20]
A
myString;` char myString[20];`

`string` B
`char*`

`intToStr()` A
`atoi()`

run time
Error c

Zero b
multi dimensional

four d
four

sorting
Int b
i
i d

it can store only one similar type of data


zero c

int n(6) = { 2, 4,
a
12, 5, 45, 5 }; int num[6]={2,3,12,45,5,6}

multiple a
sequential

Single data a
same data type

null c
Depends on storage class

a
0 some garbage value will be return
eturn type.
s recursion

ow if not handled properly

e accessed by the inner function

ctual parameter, while call by reference passes the actual parameter itself.

original value.

ginal data.
Sl.No Unit
1.
V
2.
V
3.
V
4.
V

5 V

6 v

7 V

8 V

9 V

10 V

11 V

12 V

13 V
13 V

14 V

15 V

16 V

17 V

18 V

19 V

20 V

21 V

22 V

23 V

24 V

25 V

26 V

27 V

28 V

29 V

30 V

31 V
32 V

33 V

34 V

35 V

36 V

37 V

38 V

39 V

40 V

41 V

42 V

43 V

44 V

45 V

46 V
47 V

48 V

49 V

50 V

51 V

52 V

53 V

54 V

55 V

56 V

57 V

58 V

59 V

60 v
Mannar Thirumalai Nai
Subject code: 23UCAFC11

Question

What is a pointer in C programming?


What does the "asterisk (*)" symbol represent when used in relation to
pointers?
What is the size of a pointer variable in C on a typical 32-bit system?

What is the purpose of the "address-of" operator (&) in C?

Which of the following is used to access the value stored at the address
pointed to by a pointer?

What is the difference between a NULL pointer and an uninitialized pointer?

How can you check if a pointer is NULL in C?

What is a "void pointer" in C?

What is the purpose of pointer arithmetic in C?

What is the correct syntax for declaring a pointer to an integer variable in C?

Which of the following statements correctly declares a pointer to a double?

In C, what does the asterisk (*) symbol indicate when used in a variable
declaration?

Which of the following statements declares a pointer to a character array in


C?
Which of the following statements declares a pointer to a character array in
C?

What is the purpose of declaring a pointer variable in C?


When declaring multiple pointers in a single declaration, how should you
separate them?
Which of the following is a valid way to declare an array of pointers in C?

What is the value of an uninitialized pointer in C?

What is the correct way to initialize a pointer in C?**

Which of the following statements correctly initializes a pointer to NULL?**

What does the following code snippet do? char *str = "Hello, World!";
When initializing a pointer to an integer with a specific value, which of the
following is correct?**
What does the `&` operator do in C when used with a variable?**

What is the purpose of a NULL pointer in C?**


Which of the following is the correct way to declare a pointer to an integer in
C?**
Which operator is used to access the value pointed to by a pointer in C?**

What is the size of a pointer variable in a 32-bit system?**

Which of the following statements is true about pointer arithmetic in C?**

What does the `sizeof` operator return when used with a pointer?**

What is the purpose of the `malloc` function in C?**

What does the `&` operator do in C when used with a variable?**

What is the purpose of a NULL pointer in C?**


Which of the following is the correct way to declare a pointer to an integer in
C?
Which of the following statements is true about pointer arithmetic in C?

What does the `sizeof` operator return when used with a pointer?

What is a pointer in C?

In C, which operator is used to access the value pointed to by a pointer?

What is the correct way to declare an array of integers in C?

How do you find the length of an array in C?

What does the `malloc` function in C do?

Which of the following statements is true about a null pointer in C?

Which operator is used to access the elements of an array in C?

In C, how do you pass an entire array to a function?

What is the purpose of the `sizeof` operator in C?

What is the purpose of a pointer in C programming?

Which symbol is used to declare a pointer variable in C?

In C, what does the "->" operator do when used with a pointer?


What is the purpose of the "malloc" function in C?

Which of the following is not a valid way to pass a pointer to a function in C?

What is the purpose of the "free" function in C?

Which function is used to return a value from a function in C

Which of the following is used to access the address of a variable in C?

How do you declare a pointer variable in C?

In C, what is the arrow operator (->) primarily used for?

What does the `sizeof` operator in C return for a pointer variable?

In C, what is the purpose of the `malloc` function?


What is the correct way to access the "age" member of a structure `person`
through a pointer `ptr`?
Which data type can be used to represent a single character in C?

What is the purpose of the `typedef` keyword in C?

In C, what is the purpose of the `free` function?

A function which calls itself is called a ___ function.


malai Naicker College

Option A

A data type used for storing characters

Multiplication operator

1 byte
To get the value stored at a memory
location

-> operator

There is no difference; they are the same

Use the `null` keyword.

A pointer that cannot be dereferenced

To perform arithmetic operations on


pointer variables
`int *ptr;`

`double *ptr;`

It denotes multiplication.

char *str;`
char *str;`

To allocate memory.

commas (,)Using

`int *arr

It is set to zero.

int *ptr = 10;

int *ptr = NULL;


Declares a pointer to a character array
and initializes it with "Hello, World!".
int *ptr = 42;

It returns the value of the variable.


To store a pointer to an undefined memory
location.
`integer *ptr;`

`*`

8 bytes
You can add, subtract, multiply, and divide
pointers directly
The size of the memory address.

To declare a new variable.

It returns the value of the variable.


To store a pointer to an undefined memory
location.
integer *ptr;`
You can add, subtract, multiply, and divide
pointers directly.
The size of the memory address.

A data type used to store characters

int array[];

By using the `length()` function

Multiply two numbers

It points to a specific memory location

::

By passing each element of the array


individually

To calculate the sum of two numbers

To store characters

It multiplies two numbers


To declare a new variable

Pass it by value

. To clear the screen

return

&

var ptr = &variable;`

Logical operations

The size of the data it points to

To declare a new variable

`ptr.age`

char

To create a new data type alias

To allocate memory

Recursive Function
Subject Title: Structured Programming in C

Option B

A variable that holds an integer value

Division operator

2 bytes

To declare a pointer variable

* operator

A NULL pointer points to a valid memory


location, while an uninitialized pointer has no
defined value.

Compare the pointer to the integer 0.

A pointer that points to memory filled with


zeros

To perform integer arithmetic operations

) `ptr *int;`

`ptr *double;`

It indicates a pointer variable.

`char str[];`
`char str[];`

To initialize a variable.

Using semicolons (;)

`int arr[5]*;`

It contains a random memory address.

int *ptr = &value;

int *ptr = 0;
Declares a character array and initializes it
with "Hello, World!".
int *ptr = &42;
It performs a logical AND operation on the
variable.
To point to the address 0x0000, indicating it
does not point to any valid memory location.
`int_ptr ptr;`

`->`

4 bytes

You can only add and subtract pointers.

The size of the data type the pointer points to.

To allocate memory for a new data type


It performs a logical AND operation on the
variable.
To point to the address 0x0000, indicating it
does not point to any valid memory location.
int_ptr ptr;`

You can only add and subtract pointers.

The size of the data type the pointer points to.

A variable that stores the memory address of


another variable

&

array<int>;

By subtracting the starting address from the


ending address

Allocate memory on the stack

It is the same as an uninitialized pointer

->

By passing a pointer to the array

. To determine the size of a file

To point to the next line of code

It compares two variables


To allocate memory for a variable at runtime

Pass it by reference

To release dynamically allocated memory

void

`int *ptr;`

Accessing members of a structure through a


pointer
The size of the memory address it holds

To allocate memory for a structure

`ptr->age`

character

To define a new structure

To clear the screen

Static
ng in C

Option C Option D
A variable that stores the A function that points to other
address of another variable functions
Pointer declaration and
Addition operator
dereferencing
4 bytes 8 bytes
To get the address of a
To perform bitwise AND operation
variable

& operator . poerator

An uninitialized pointer is set


An uninitialized pointer is
to zero, while a NULL pointer is
automatically initialized by the
set to an invalid memory
compiler, while a NULL pointer is not
address.

) There is no way to check for NULL


Use the `NULL` keyword.
pointers in C.

A pointer that is automatically


initialized by the compiler A pointer that can point to any data
type
To increment the value of a
To multiply two pointers together
pointer
`int ptr*;` ptr int*;`

`ptr double*;` `double ptr*;`

It represents exponentiation. It is used for bitwise operations.

`string str;` `char[] *str;`


`string str;` `char[] *str;`

To store the address of another


To perform arithmetic operations.
variable.
Using colons (:) Using plus signs (+)

`int **arr[5];` `int[5] *arr;`


It points to the address of the
It cannot be determined
main function.
int *ptr = (int
int ptr = &value;
*)malloc(sizeof(int));
int *ptr = (int
int *ptr;
*)malloc(sizeof(int));
Declares a pointer to a
Declares a character array but leads
character array but leads to a
to a compilation error.
compilation error.
int *ptr = (int *)42; int *ptr; *ptr = 42;
It returns the memory address
It is used to declare a new variable.
of the variable.
To store a pointer to the end of To store a pointer to the beginning of
an array. an array.
int ptr*;` `int *ptr;`

`.` `&`

2 bytes It depends on the compiler.


Pointer arithmetic is not Pointer arithmetic is only possible
allowed in C. with character pointers.
The size of the pointer variable The number of elements in the array
itself. pointed to by the pointer
To dynamically allocate memory for
To allocate memory for a new
data storage during program
pointer.
execution.
It returns the memory address
It is used to declare a new variable.
of the variable.
To store a pointer to the end of To store a pointer to the beginning of
an array. an array.
`int ptr*;` `int *ptr;`
Pointer arithmetic is not Pointer arithmetic is only possible
allowed in C. with character pointers.
The size of the pointer variable The number of elements in the array
itself. pointed to by the pointer.
A reserved keyword for arithmetic
A variable used to store arrays
operations

-> %

. int[] array; int array[10];


By using the `sizeof` operator
divided by the size of one By using the `length` keyword
element
Calculate the square root of a
Allocate memory on the heap
number

It points to address 0 It cannot be used in C

. []

By declaring the array inside the


By using a global array
function

To calculate the size of a data


To find the square root of a number
type or variable

To point to the memory


To perform arithmetic operations
address of a variable
* $
It accesses a member of a
It calculates the remainder of division
structure through a pointer
To print output to the console To perform mathematical operations

Pass it as a function argument Pass it as a global variable

To terminate the program To close a file

main printf

$ %

`ptr *int;` `pointer variable = &var;`

. Bitwise operations Arithmetic operations


The size of the pointer variable It is not possible to determine the
itself size of a pointer
To allocate memory for a
To free memory
pointer
`ptr[age]` `ptr::age`

chr singlechar

To declare a pointer variable To allocate memory


To release previously allocated
To print text to the console
memory
Dynamic multiple
Correct option

C
A variable that stores the address of another variable
C
Pointer declaration and dereferencing
C
4 bytes
C
To get the address of a variable

* operator
B

A NULL pointer points to a valid memory location, while an un


B

Use the `NULL` keyword.


C

D 0

A
To perform arithmetic operations on pointer variables
A
`int *ptr;`
A
`double *ptr;`

It indicates a pointer variable.


B

char *str;`
A
A

C
To store the address of another variable.
A
commas (,)Using
A
`int *arr
B
It contains a random memory address.
B
int *ptr = &value;
A
int *ptr = NULL;
A
Declares a pointer to a character array and initializes it with "
C
int *ptr = (int *)42;
C
It returns the memory address of the variable.
B
To point to the address 0x0000, indicating it does not point to
D
`int *ptr;`
A
`*`
B
4 bytes
B
You can only add and subtract pointers.
C
The size of the pointer variable itself.
D
To dynamically allocate memory for data storage during progr
C
It returns the memory address of the variable.
B
To point to the address 0x0000, indicating it does not point to
D
`int *ptr;`
B
You can only add and subtract pointers.
C
The size of the pointer variable itself.

B A variable that stores the memory address of another variable

A
*
D
int array[10];

C By using the `sizeof` operator divided by the size of one elem

C
Allocate memory on the heap

It points to address 0
C

D
[]

By passing a pointer to the array


B

To calculate the size of a data type or variable


C

C
To point to the memory address of a variable
C
*
C
It accesses a member of a structure through a pointer
B
To allocate memory for a variable at runtime
A
Pass it by value

B To release dynamically allocated memory

A return

A &

B `int *ptr;`

B
Accessing members of a structure through a pointer
C
The size of the pointer variable itself
B
To allocate memory for a structure
B
`ptr->age`
A
char
A
To create a new data type alias
C
To release previously allocated memory
a
Recursive Function
other variable

location, while an uninitialized pointer has no defined value.

nter variables
and initializes it with "Hello, World!".

riable.

ng it does not point to any valid memory location.

a storage during program execution.

riable.

ng it does not point to any valid memory location.


ess of another variable

y the size of one element

ough a pointer
gh a pointer

You might also like