0% found this document useful (0 votes)
52 views1 page

Cse 1203 CT1

This document contains a class test for a Structured Programming course with two questions. Question 1 involves arrays, including listing valid and invalid array declarations and writing a program to multiply two matrices. Question 2 covers pointers, including benefits over arrays, evaluating expressions involving a 2D array, and dynamically allocating memory for a 2D pointer array. The test is out of 20 total marks and must be completed within 45 minutes.

Uploaded by

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

Cse 1203 CT1

This document contains a class test for a Structured Programming course with two questions. Question 1 involves arrays, including listing valid and invalid array declarations and writing a program to multiply two matrices. Question 2 covers pointers, including benefits over arrays, evaluating expressions involving a 2D array, and dynamically allocating memory for a 2D pointer array. The test is out of 20 total marks and must be completed within 45 minutes.

Uploaded by

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

Department of Computer Science and Engineering

Mawlana Bhashani Science and Technology University


1st Year 2nd Semester B.Sc. (Engg.) Class Test-1
Course Code: CSE-1203 Course Title: Structured Programming
Time: 45 min Total marks: 20

1. a) Write down the advantages of array. 2


b) For array please specify which declarations are valid/invalid 4
i) int abc[2];
ii) int abc[];
iii) int abc[2]={1,2};
iv) int abc[]={1,2};
v) int abc[2][2] = {1, 2, 3 ,4 }; 
vi) int abc[][2] = {1, 2, 3 ,4 };
vii) int abc[][] = {1, 2, 3 ,4 };  
viii) int abc[2][] = {1, 2, 3 ,4 };

c) Write a program to multiply two matrix. Note that number of row and column must 4
be specified by the user as input, which implies validation checking of possibility of
multiplication.

2 a) Briefly discuss the benefits of pointer over array. 2


b) Let, int matrix[2][2]={1,2,3,4}; Now write down the values of the following 4
expressions.

i. *(*(matrix + 0))
ii. *(*(matrix + 0) + 0)
iii. *(*matrix + 1)
iv. *(*(matrix + 0) + 1)

c) Replace the dots with appropriate syntax of the following code segment for dynamic 4
memory allocation of a 2D pointer.

int** arr = (…..)malloc(row * sizeof(…..));


for (i = 0; i < r; i++)
arr[i] = (….)malloc(col * sizeof(…..));

You might also like

pFad - Phonifier reborn

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

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


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy