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

2D Array Knowledge Test

This document contains 13 problems related to 2D arrays in C programming. The problems cover initializing and accessing 2D arrays, printing array contents, finding sums and maximums, transposing matrices, and determining if a matrix is an identity matrix. It also includes string problems like determining if a name starts with a vowel, counting the length of a string, and reversing a string. The document tests the learner's knowledge of 2D arrays and basic string manipulation in C.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

2D Array Knowledge Test

This document contains 13 problems related to 2D arrays in C programming. The problems cover initializing and accessing 2D arrays, printing array contents, finding sums and maximums, transposing matrices, and determining if a matrix is an identity matrix. It also includes string problems like determining if a name starts with a vowel, counting the length of a string, and reversing a string. The document tests the learner's knowledge of 2D arrays and basic string manipulation in C.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

2D ARRAY

KNOWLEDGE
TEST

Fast Code Ver 2


2D ARRAY
KNOWLEDGE
TEST
Rules:
PRESENTATION TITLE

Question #1

What will be printed if I reference a content of the array with:

*( *( x + 2 ) + 1)
Output:4

9/3/20XX 3
4

QUESTION #2

What will be printed if I reference a content


of the array with:

*( *(x + 2 ) + 5
Output: Garbage value
PRESENTATION TITLE

Question #3

What will be printed if I reference a content of the array with:

*n
Output: 1

9/3/20XX 5
6

QUESTION #4

What will be printed if I reference a content


of the array with:

*(n + 5)+1
Output: 7
PRESENTATION TITLE

Question #5

What will be printed if I reference a content of the array with:

++*n Output: 2

9/3/20XX 7
8

PROBLEM #1
Initialize a 2D array with a dimension
of 3 by 3 (Content of the array should
be user input)
PRESENTATION TITLE

Problem #2
Initialize a 2D array with a dimension of 3 by 3
(Content of the array should be user input) and
print the content at
Row 2, col 2
Row 0, col 1
Row 2, col 1

9/3/20XX 9
10

PROBLEM #3
Initialize a 2D array with a dimension of 3
by 3 (Content of the array should be user
input) and print all of its content in a matrix
form
PRESENTATION TITLE

Problem #4
Initialize a 2D array with a dimension of 3 by 3
(Content of the array should be user input) and
prints all its content.
Printing should be done using a pointer

11
12

PROBLEM #5
Initialize a 2D array with a
dimension of 2 by 4 (Content of
the array should be user input
and in main) and print all its
contents in a function
PRESENTATION TITLE

Problem #6
Initialize a 2D array with a dimension of 2 by 4 (Content of the array
should be user input and in main) and finds the sum of each row of
the array and prints it in a function

13
14

PROBLEM #7
Write a program to obtain transpose of a
3x 3 matrix. The transpose of a matrix is
obtained by exchanging the elements of
each row with the elements of the
corresponding column.
Problem #8
PRESENTATION TITLE

Initialize a 2D array with a dimension


of 4 by 4 (Content of the array should
be user input and in main) and
identify if the matrix is an identity
matrix

15
PRESENTATION TITLE

Problem #10
Write a program to pick up the largest number
from any 3 row by 3 column matrix.

16
PROBLEM #11
17

Write a program that initializes a string with a maximum of


100 elements and should ask the user his/her name as an
input.
Problem #12
PRESENTATION TITLE

Using the code from problem #11, if


the users name starts with a vowel,
the program should output
“A pleasant day, your Highness
<name of the user>”
if otherwise, the program should
print
“Hello! Peasant <name of the user
here>”.

18
19

PROBLEM #12
Using the program from the previous
problem, the program should counts
the length of the inputted string
without using a library function
Problem #13
PRESENTATION TITLE

Using the program from the previous problem, add


a function that if the inputted name is classified as
peasant, will reverse the name inputted, prints it
and says, “this is your new name”.

20

You might also like