Sample Paper
(Programming in C CSIT140)
BCA 1st Sem.
[Max Marks: 70]
Note: Attempt Questions from all sections as directed.
Section A - Attempt any Two questions out of Four. Each question carries 7.50 marks. [15
Marks]
Question No: 1
Explain the different types of memory with example.
Question No: 2
Explain the different looping concept in C programming and write the C Code for addition of
any 10 numbers.
Question No: 3
Explain the recursion concept with how it works? Write a C Code to find the factorial using
recursion.
Question No: 4
What is the difference between structure and union? Explain with example how to create the
structure and elements are accessed from structure for the student record.
Section B - Compulsory Questions. Each question carries 7.50 marks. [15 Marks]
When a variable is created in C, a memory address is assigned to the variable.
The memory address is the location of where the variable is stored on the
computer. When we assign a value to the variable, it is stored in this memory
address.To access it, use the reference operator (&), and the result will represent
where the variable is stored:
Question No: 1
What is the difference between static and dynamic memory location, explain with example?
Question No: 2
Define Pointer and how value is stored using pointer? Access the 10 array elements using
pointer.
Section C - Compulsory Questions. Each question carries 2.00 marks. [40 Marks]
Question No: 1
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *s = "hello";
char *p = s;
printf("%p\t%p", p, s);
}
a) Different address is printed
b) Same address is printed
c) Run time error
d) Nothing
Question No: 2
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int *p = ary + 3;
printf("%d %d\n", p[-2], ary[*p]);
}
a) 2 3
b) Compile time error
c) 2 4
d) 2 some garbage value
Question No: 3
Who is the father of C language?
a) Steve Jobs
b) James Gosling
c) Dennis Ritchie
d) Rasmus Lerdorf
Question No: 4
All keywords in C are in ____________
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned
Question No: 5
Which is valid C expression?
a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;
Question No: 6
Which of the following declaration is not supported by C language?
a) String str;
b) char *str;
c) float str = 3e2;
d) Both String str; & float str = 3e2;
Question No: 7
What is an example of iteration in C?
a) for
b) while
c) do-while
d) all of the mentioned
Question No: 8
Functions in C Language are always _________
a) Internal
b) External
c) Both Internal and External
d) External and Internal are not valid terms for functions
Question No: 9
What is #include <stdio.h>?
a) Preprocessor directive
b) Inclusion directive
c) File inclusion directive
d) None of the mentioned
Question No: 10
How many number of pointer (*) does C have against a pointer variable declaration?
a) 7
b) 127
c) 255
d) No limits
Question No: 11
In C language, FILE is of which data type?
a) int
b) char *
c) struct
d) None of the mentioned
Question No: 12
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
a) Compile time error
b) Hello World! 34
c) Hello World! 1000
d) Hello World! followed by a junk value
Question No: 13
What will be the output of the following C code on a 64 bit machine?
#include <stdio.h>
union Sti
{
int nu;
char m;
};
int main()
{
union Sti s;
printf("%d", sizeof(s));
return 0;
}
a) 8
b) 5
c) 9
d) 4
Question No: 14
What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
a) 3.75
b) Depends on compiler
c) 24
d) 3
Question No: 15
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
do
{
i++;
if (i == 2)
continue;
printf("In while loop ");
} while (i < 2);
printf("%d\n", i);
}
a) In while loop 2
b) In while loop in while loop 3
c) In while loop 3
d) Infinite loop
Question No: 16
Which of the following is not an operating system?
a.) Windows
b.) Linux
c.) Oracle
d.) DOS
Question No: 17
What are the elements present in the array of the following C code?
int array[5] = {5};
a) 5, 5, 5, 5, 5
b) 5, 0, 0, 0, 0
c) 5, (garbage), (garbage), (garbage), (garbage)
d) (garbage), (garbage), (garbage), (garbage), 5
Question No: 18
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y || z++;
printf("%d", z);
}
a) 6
b) 5
c) 0
d) Varies
Question No: 19
What will this program print?
main()
{
int i = 2;
{
int i = 4, j = 5;
printf("%d %d", i, j);
}
printf("%d %d", i, j);
}
a. 4525
b. 2525
c. 4545
d. None of the these
Question No: 20
What is the output of this statement "printf("%d", (a++))"?
a. The value of (a + 1)
b. The current value of a
c. Error message
d. Garbage