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

2020 - BCA 2 Sem Programming Through C-IISem-BCA2CC08

This document contains details about a BCA Programming Language Through C paper for the II Semester at Government Zirtiri Residential Science College. It includes: 1. 75 multiple choice questions covering 6 units of the course material. Questions cover topics like the history of C, compilers, variables, data types, operators, loops, functions, and more. 2. The questions are in a multiple choice format with 4 possible answers for each. 3. An explanation of the format of the exam, which will include these 75 multiple choice questions.

Uploaded by

manishkharwar.hh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

2020 - BCA 2 Sem Programming Through C-IISem-BCA2CC08

This document contains details about a BCA Programming Language Through C paper for the II Semester at Government Zirtiri Residential Science College. It includes: 1. 75 multiple choice questions covering 6 units of the course material. Questions cover topics like the history of C, compilers, variables, data types, operators, loops, functions, and more. 2. The questions are in a multiple choice format with 4 possible answers for each. 3. An explanation of the format of the exam, which will include these 75 multiple choice questions.

Uploaded by

manishkharwar.hh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Government Zirtiri Residential Science College

Subject: BCA
Paper name: Programming Language Through C
Paper No: BCA/2/CC/08
Semester: II Semester

A. Multiple choice questions [75 (15 from each unit)]

1. C Language developed at _________


a) AT & T’s Bell Laboratories at USA in 1972
b) AT & T’s Bell Laboratories at USA in 1970
c) Microsoft in 1972
d) Cambridge University in 1970

2. C Programs are converted into machine language with the help of


a) An editor
b) An Operating System
c) A compile
d) An IDLE

3. C Variable cannot start with


a) Special symbol
b) Number
c) Underscore
d) Both A & B

4. Which of the following is not a reserve keyword for C


a) main
b) auto
c) register
d) default

5. Which of the following is not a correct variable type


a) int
b) double
c) float
d) real

6. What is the difference between a declaration and a definition of a variable


a) Both can occur multiple times, but a declaration must occur first
b) Both can occur multiple times, but a definition must occur first

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

c) A declaration occurs once, but a definition may occur many times


d) A definition occurs once, bur a declaration occur many times

7. Which of the following type of operators have the highest precedence


a) Arithmetic operators
b) Conditional operators
c) Logical operators
d) Relational operators

8. Which operator has the lowest priority


a) ++
b) - -
c) ||
d)&&

9. What is Sizeof()
a) Function
b) Macro
c) Operator
d) Preprocessor

10. Which of the following is bitwise operator


a) &&
b) ||
c) |
d) both a & b

11. Which of the following escape sequence is used to move the cursor to the next line on the
screen
a) \t
b) %d
c) \l
d) \n

12. Which of the following is used to read single character


a) getchar()
b) getch()
c) getc()
d) get()

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

13. Which of the following header file contain mathematical function


a) math.h
b) maths.h
c) string.h
d) conio.h

14. The size of short int is


a) 16 bit
b) 8 bit
c) 4 bit
d) 1 bit

15. The size of char is


a) 1 bit
b) 8 bit
c) 16 bit
d) 32 bit

16. Which of the following is an entry controlled loop statement


a) do
b) if
c) else
d) while

17. Whats wrong in the following statement, provided k is a variable of type int
For (k=2, k<=10,k++)
a) The variable k should be 0
b) There should be a semicolon at the end of the statement
c) The variable must always be the letter i
d) The comma should be a semicolon

18. What is the output of the program


#include <stdio.h>
Void main()
{
int i;
for (i = 1; i != 10; i += 2)
printf(" BCA ");
}
a) BCA BCA BCA BCA
b) BCA BCA BCA … infinit time
c) BCA BCA BCA BCA BCA

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

d) BCA BCA

19. Choose the right statement


a) Loops usually take advantage of loop counter
b) Loop block executes a group of statements repeatedly
c) Loop is usually executed as long as a condition is met
d) All of the above

20. In the following loop construct, which one is executed only once always.
for(exp1; exp2; exp3)
a) exp1
b) exp2
c) exp3
d) none of the above

21. The continue statement cannot be used with


a) for
b) while
c) switch
d) if

22. Which loop is guaranteed to execute at least one time


a) for
b) while
c) do while
d) all of the aboe

23. For loop in a C program, if the condition is missing


a) it is assumed to be present and taken to be false
b) it is assumed to be present and taken to be true
c) it result in a syntax error
d) execution will terminated

24. It switch statement is used, then


a) Default case must be present
b) Default case, if used, can be place any where
c) Default case, if used, should be the last case
d) None of the above.

25. Which of the following is an invalid if-else statement

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

a) if (funct(a)){}
b) if(if(a==4)){}
c) if(a){}
d) none of the above

26. What will be the output of the following


#include <stdio.h>
void main()
{
int i=0;
for (i<3;i++);
printf(“hello ”);
}
a) hello hello hello
b) hello hello hello hello
c) compile time error
d) runtime error

27. What is the output of c program


void main()
{
int a=21;
while(a<=23)
{
printf(“%d “,a);
a++;
}
}
a)infinite loop
b) 21 22 23
c) 21 22
d) runtime error

28. What is the output of c program


void main()
{
int i=36
do
{
printf(“%d”,i);

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

}
while(i<=35);
}
a) 36
b) 35
c) 36 35
d) 35 36

29. Find the error in the following c program


void main()
{
int m; char g;
switch (m)
{
case 1: grade=”p”;break;
case 2: grade=”A”;break;
case 3: grade =”B”;break;
}
}
a) case label cannot be number
b) default is not present
c) undefined symbol grade
d) undefined symbol A

30. How many times will the following loop be executed


ch=’b’;
while(ch>=’a’&&ch<=’z’)
a) 0
b) 24
c) 25
d) 26

31. Any C Program


a) Needs input data
b) Must contain at least one function
c) Need not contain any function
d) None of the above

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

32. How many values can a C function return at a time


a) one
b) two
c) three
d) infinity

33. Types of C Function


a) Library Function
b) User defined function
c) Both a and b
d) None of the above

34. Choose correct statements about C Language pass by value


a) Pass by value copies the variable value in one more memory location
b) Pass by value does not use pointer
c) Pass by value protects source or original variable from changes in outside functions or
called function
d) All of the above

35. The default parameter passing mechanism of c function is


a) pass by value
b) pass by reference
c) pass by pointer
d) None of the above

36. The declaration


void cal(int);
indicate cal is the function which
a) return nothing
b) has no arguments
c) both a and b
d) None of the above

37. Use of function


a) make the debugging task easier
b) helps to avoid repeated programming across program
c) helps to avoid repeating a set of statements many times
d) All of the above

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

38. Pick the correct statements


i. The body of a function should have only one return statement
ii. The body of a function may have many return statement.
iii. A function can return only one value to the calling environment
iv.If return statement is omitted, then the function does its job but return no value to the
calling environment
a) i and ii
b) i and ii
c) ii and iii
d) iii and iv

39. Which of the following function calculates the square of ‘x’ in c


a) sqr(x)
b) pow(2,x)
c) pow(x,2)
d) power(2,x)

40. Which function definition run correctly


a) int sum (int a, int b);retrun (a + b);
b) int sum (int a, int b){ return (a+b);}
c) int sum (a,b){return(a+b);}
d) none of the above

41. What is the output of this C code


int x = 5;
void main()
{
int x = 3;
m();
printf("%d", x);
}
void m()
{
x = 8;
n();
}
void n()
{
printf("%d", x);
}

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

a) 8 3
b) 8 5
c) 3 8
d) 5 3

42. What is the output of this program


#include<stdio.h>
int test()
{
static int n = 10;
return n--;
}
int main()
{
for(test(); test(); test())
printf("%d ", test());
return 0;
}
a) Infinite loop
b) compilation error
c) 741
d) 852

43. Which of the following statements are correct about the function
long fun(int num)
{
int i;
long f=1;
for(i=1; i<=num; i++)
f = f * i;
return f;
}
a) Function calculate the value of 1 raise to power number
b) Function calculate the square root of an integer
c) Function calculate the factorial of an integer
d) None of the aove

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

44. In C, if you pass an array as an argument to a function, what actually gets passed?
a) Value of an elements in array
b) First element of the array
c) Base address of the array
d) Address of the last element of the array

45. Forward declaration is absolutely necessary


a) if a function returns a non-integer quantity
b) lithe function call precedes its definition
c) if the function call precedes its definition and the function returns a non integer quantity
d) All of the above

46. What does the following declaration mean?


int (*ptr)[10];
a) ptr is array of pointers to 10 integers
b) ptr is a pointer to an array of 10 integers
c) ptr is an array of 10 integers
d) ptr is a pointer to array

47. Choose the best one prior to using a pointer variable


a) It should be declared.
b) It should be initialized.
c) It should be both declared and initialized.
d) None of the above.

48. What is the maximum number of dimensions an array in C may have?


a) one
b) two
c) three
d) Theoretically no limit. The only practical limits are memory size and compilers

49. Size of the array need not be specified, when


a) Initialization is a part of definition
b) It is a formal parameter
c) It is a declaratrion
d) All of the above

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

50. The parameter passing mechanism of an array is


a) call by value
b) call by reference
c) call by pointer
d) all of the aove

51. Let x be an array.Which of the following operations is illegal?


i) ++x.
ii) x+1.
iii) x++.
iv) x*2.
a) i and ii
b) i, ii and iii
c) ii and iii
d) i, iii and iv

52. An array elements are always stored in ________ memory locations.?


a) sequential
b) random
c) index
d) a and b

53. A pointer is
a) A keyword used to create variables
b) A variable that stores address of other variable
c) A variable that stores address of an instruction
d) All of the above

54. In C a pointer variable to an integer can be created by the declaration


a) int &p
b) int p&
c) int *p
d) int p*

55. Consider the declaration


int a = 5, *b = &a;
The statement
printf("%d", a * b);
prints
a) garbage

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

b) an error message
c) a x address of b
d) a x address a

56. Consider the following segment


char *a, *b, c[10], d[10];
a = b; b = c; c = d; d = a;
choose the statements having errors
a) c = d; and d = a;
b) a = b; and b = c;
c) a = b; and d = a;
d) no error

57. A pointer variable can be


a) Passed to a function
b) Changed within a function
c) Can be assigned an integer value
d) Returned by a function

58. What will be the output of the following program


#include<stdio.h>
int main()
{
int i=3, *j, k;
j = &i;
printf("%d\n", i**j*i+*j);
return 0;
}
a) 30
b) 9
c) 29
d) 27

59. The reason for using pointers in a Cprogram is


a) Pointers allow different functions to share and modify their local variables.
b) To pass large structures so that complete copy of the structure can be avoided.
c) Pointers enable complex “linked" data structures like linked lists and binary trees.
d) All of the above

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

60. Consider the statement, point out the correct answer.


const int *ptr;
a) You cannot change the value pointed by ptr
b) You cannot change the pointer ptr itself
c) You can change the pointer as well as the value pointed by it
d) Both (a) and (b)

61. Which of the following cannot be a structure member?


a) Array
b) Function
c) Structure
d) None of the above

62. Union differs from structure in the following way


a) Union cannot have more members
b) Only one member can be used at a time
c) All members are used at a time
d) Only one member can be used at a time

63. Size of a union is determined by size of the


a) First member in the union
b) Last member in the union
c) Sum of the sizes of all members
d) Biggest member in the union

64. Which of the following are themselves a collection of different data types?
a) char
b) String
c) Structure
d) All of the above

65. Members of the union are accessed as ______


a) union_name.member
b) union_pointer->member
c) both a and b
d) none of the above

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

66. What is the output of this program


#include <stdio.h>
struct test {
int x;
char y;
} test;
int main()
{
test.x = 10;
test.y = 'A';
printf("%d %c", test.x,test.y);
return 0;
}
a) Compilation error
b) 10 A
c) A 10
d) None of the above

67. Which of the following are incorrect syntax for pointer to structure?
(Assuming struct temp{int b;}*my_struct;)
a) *my_struct.b = 10;
b) (*my_struct).b = 10;
c) my_struct->b = 10;
d) Both *my_struct.b = 10; and (*my_struct).b = 10;

68. The correct syntax to access the member of the ith structure in the array of structures is?
Assuming:
struct temp
{
int b;
}s[50];
a) s[i].b;
b) s.[i].b;
c) s.b.[i];
d) s.b[i];

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

69. Which of the following true about FILE *fp


a) FILE is a structure and fp is a pointer to the structure of FILE type
b) FILE is a stream
c) FILE is a buffered stream
d) FILE is a keyword in C for representing files and fp is a variable of FILE type.

70. Which type of files can’t be opened using fopen()?


a) .txt
b) .c
c) .bin
d) None of the above

71. If there is any error while opening a file, fopen will return?
a) Null
b) EOF
c) Nothing
d) 0

72. What Select a function which is used to write a string to a file…


a) pits()
b) putc()
c) fputs()
d) fgets()

73. Which Is data type of file pointer


a) File
b) int
c) char
d) float

74. The fseek function


a) needs 3 arguments
b) makes the rewind function unnecessary
c) is meant for checking whether a given file exists or not
d) both a and b

75. What is the output of the following program


#include<stdio.h>
int main(){
char c;

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

FILE *fp;
fp=fopen("demo.txt","r");
while((c=fgetc(fp))!=EOF)
printf("%c",c);
fclose(fp);
return 0;
}
a) It will print the content of file till it encounter new line character
b) It will print the content of file demo.txt
c) Compilation Error
d) None of the above

B. Fill up the blanks [15 (3 from each unit)]

1. _____________ is Father of C Language


2. Standard ANSI C recognizes ______________ number of keywords
3. The __________________ operators are used for testing the bits, or shifting tem right or left
4. ____________ statement is used to skip the rest of the loop and carry on from the top of the
loop again
5. ____________ statement is used to exit the loop
6. The type of controlling expression of a switch statement cannot be of the type
_____________
7. A function which calls itself is called a _______________ function
8. The keyword used to transfer control from a function back to the calling function
is___________
9. A function that uses variable type is called ________________-
10. Array can be considered as set of elements stored in consecutive memory locations but
having __________
11. Array is an example of _______ type memory allocation.
12. In order to fetch the address of the variable we write preceding _________ sign before
variable name.
13. ______ operator connects the structure name to its member name
14. Fflush (NULL) flushes all ____________
15. FILE is of type ______

Key Answers

A. Multiple choice questions [replace x]

1. a) 2. c) 3. d) 4.a) 5. d) 6.c) 7. a)

Downloaded from www.gzrsc.edu.in


Government Zirtiri Residential Science College

8. c) 9. c) 10. c) 11. d) 12. a) 13. a) 14. b)


15. b) 16. d) 17. d) 18. b) 19. d) 20. a) 21. c)
22. c) 23. b) 24. b) 25. b) 26. a) 27. b) 28. a)
29. c) 30. c) 31. b) 32. a) 33. c) 34. d) 35. a)
36. a) 37. d) 38. d) 39. c) 40. b) 41. a) 42. d)
43. c) 44. c) 45. c) 46. b) 47. c) 48. d) 49. a)
50. b) 51. d) 52. a) 53. b) 54. c) 55. b) 56. a)
57. d) 58. a) 59. d) 60. a) 61. b) 62. d) 63. d)
64. c) 65. c) 66. b) 67. a) 68. a) 69.a) 70. d)
71. a) 72. c) 73. a) 74. d) 75. b)

B. Fill up the blanks [replace x]

1. Dennis Ritchie
2. 32
3. Bitwise
4. Continue
5. Break
6. float
7. Recursive
8. return
9. Variable function
10. Same data type
11. Compile time
12. Ampersand(&)
13. .
14. output stream
15. Struct type

Downloaded from www.gzrsc.edu.in

You might also like