Professional Documents
Culture Documents
CSE - CS103 - ST1 - SETB - 2019: Test Summary
CSE - CS103 - ST1 - SETB - 2019: Test Summary
CSE_CS103_ST1_SETB_2019
Test Summary
No. of Sections: 2
No. of Questions: 12
Total Duration: 90 min
Section 1 - MCQ
Section Summary
No. of Questions: 10
Duration: 30 min
Additional Instructions:
None
Q1. Which header le should be included to use functions like malloc() and calloc()?
memory.h
stdlib.h
string.h
dos.h
10
Garbage Value
No Output
Syntax Error
}
int main()
{
F(123456789);
printf("%d",cnt);
return 0;
}
123456789
10
No output
GandhiBlock
GandhiBlock11
GandhiBlock10
No output
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 2/11
9/2/2019 CU Exams
Q6. Will the given function results in memory leak?
int* func1()
{
int *p;
p = (int*)malloc(4);
return p;
}
yes
no
unde ned
syntax error
Q7. Which of the below code snippets performs bubble sort to sort the elements in ascending order?
#include<stdlib.h>
int main()
{
int *p;
p = (int *)malloc(10); /* Assume p has address of 1000 */
free(p);
printf("%u", p);
return 0;
}
10
Garbage value
1000
Random address
10
Garbage Value
Syntax Error
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 4/11
9/2/2019 CU Exams
Section 2 - CODING
Section Summary
No. of Questions: 2
Duration: 60 min
Additional Instructions:
None
Q1. The following question contains function bubblesort() to sort the array of size 'n' till 'p' number of passes.The main is used scan the
size and p(pass till
which array need to be sorted).The rst entry will be the 'n' that is the number of elements in aray followed by the value 'p' no of
passes.The function should store
the array after p passes.
Constraints:
1>=n<=10000
1>=p<=n-1
Sample Input:
8 // no. of elements in array
3 // no. of passes
5
3
1
9
8
2
4
7
Sample Output://resultant array after 3 passes
13245789
8 1 3 2 4 5 7 8 9
3
5
3
Time Limit: - ms Memory Limit: - kb Code Size: - kb
Sample Input:
9
Sample Output:
0
1
1
2
3
5
8
13
21
9 0
1
1
2
Time Limit: - ms Memory Limit: - kb Code Size: - kb
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 6/11
9/2/2019 CU Exams
Solution
No Solution
Q2
No Output
Solution
No Solution
Q3
9
Solution
No Solution
Q4
k
Solution
No Solution
Q5
GandhiBlock11
Solution
No Solution
Q6
yes
Solution
No Solution
Q7
void bubbleSort(int array[], int n)
int i, j, temp;
{
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 7/11
9/2/2019 CU Exams
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
Solution
No Solution
Q8
1000
Solution
No Solution
Q9
10
Solution
No Solution
Q10
5
Solution
No Solution
Section 2 - CODING
Q1
Test Case
Input Output
5 2 1 6 7 9
2
6
2
Weightage - 20
Input Output
4 33 22 11 44
1
44
33
Weightage - 20
Input Output
8 12 7 22 30 33 67 77 88
5
33
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 8/11
9/2/2019 CU Exams
Weightage - 20
Input Output
6 4 5 6 7 8 9
5
9
8
Weightage - 20
Input Output
5 9 32 45 66 77
3
77
66
Weightage - 20
8 1 3 2 4 5 7 8 9
3
5
3
Solution
Header
#include <stdio.h>
int n,p;
Footer
int main()
{
scanf("%d",&n);
scanf("%d",&p);
int data[n];
for(int i=0; i<n; i++)
scanf("%d ", &data[i]);
bubbleSort(data, p);
Q2
Test Case
Input Output
5 0
1
1
2
Weightage - 20
Input Output
11 0
1
1
2
Weightage - 20
Input Output
5 0
1
1
2
Weightage - 20
Input Output
7 0
1
1
2
Weightage - 20
Input Output
18 0
1
1
2
Weightage - 20
9 0
1
1
2
Solution
Header
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 10/11
#include<stdio h>
#include<stdio.h>
9/2/2019 CU Exams
int f(int);
int f(int n)
{
if (n == 0 || n == 1)
return n;
else
return (f(n-1) + f(n-2));
}
Footer
int main()
{
int n, i = 0, c;
scanf("%d", &n);
return 0;
}
https://admin.exam.chitkarauniversity.edu.in/school/test/preview?test_id=b74adb47-a622-4fbc-8a58-3a47fff1f788&branch_id=0c6a9640-ac31-4d4c-9fdd-a4d82966e1a4&isprint=true 11/11