Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
139 views

Programming in C Question Bank

The document contains a 30 question quiz on programming in C with one mark awarded for each correct answer. The questions cover topics such as: who developed C, what operating systems C can be used on, how C programs are converted to machine language, valid data types in C, and operators and expressions in C.

Uploaded by

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

Programming in C Question Bank

The document contains a 30 question quiz on programming in C with one mark awarded for each correct answer. The questions cover topics such as: who developed C, what operating systems C can be used on, how C programs are converted to machine language, valid data types in C, and operators and expressions in C.

Uploaded by

meraboor9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

BCA SEMESTER I

SUBJECT: PROGRAMMING IN C

SECTION – A- One Marks Each

1. C language has been developed by


a. Ken Thompson
b. Dennis Ritchie
c. Peter Norton
d. Martin Richards

2. C can be used on _________.

a. Only MS-DOS operating system


b. Only Linux operating system
c. Only Windows operating system
d. All the above

3. C programs are converted into machine language with the help of _____________.

a. An Editor
b. A compiler
c. An operating system
d. None of the above

4. The real constant in C can be expressed in which of the following forms

a. Fractional form only


b. Exponential form only
c. ASCII form only
d. Both fractional and exponential forms

5. A character variable can at a time store _______________.

a. 1 character
b. 8 characters
c. 254 characters
d. None of the above

6. The statement char ch = ‘Z’ would store in ch

a. The character Z
b. ASCII value of Z
c. Z along with the single inverted commas
d. Both (1) and (2)

BCA Sem I - Question Bank pg. 17


7. Which of the following is NOT a character constant?

a. Thank You’
b. ‘Enter values of P, N, R’
c. ‘23.56E-03’
d. All the above

8. The maximum value that an integer constant can have is ________________.

a. -32767
b. 32767
c. 1.7014e+38
d. –1.7014e+38

9. A C variable cannot start with __________________.

a. An alphabet
b. A number
c. A special symbol other than underscore
d. Both (2) &(3) above

10. Which of the following statement is wrong?

a. mes = 123.56
b. con = T* A;
c. this = T* 20
d. 3+a=b

11. Which of the following is allowed in a C Arithmetic instruction?

a. []
b. {}
c. ()
d. None of the above

12. Which of the following statements is false?

a. Each new C instruction has to be written on a separate line


b. Usually all C statements are entered in small case letters
c. Blank spaces may be inserted between two words in a C statement
d. Blank spaces cannot be inserted within a variable name

13. If a is an integer variable, a = 5 / 2 ; will return a value ___________.

BCA Sem I - Question Bank pg. 18


a. 2.5
b. 3
c. 2
d. 0

14. Hierarchy decides which operator ______________.

a. is most important
b. is used first
c. is fastest
d. operates on largest numbers

15. An integer constant in C must have:

a. At least one digit


b. Atleast one decimal point
c. A comma along with digits
d. Digits separated by commas

16. A character variable can never store more than ________________.

a. 32 characters
b. 8 characters
c. 254 characters
d. 1 character

17. In C a variable cannot contain ________________.

a. Blank spaces
b. Hyphen
c. Decimal point
d. All the above

18. %c specifier is used for which data type?

a. character
b. integer
c. float
d. double

19. Correct way to name an identifier or variable?

a. 1A
b. !A
c. A_1
d. None of these

BCA Sem I - Question Bank pg. 19


20. Size of character data type _______________.

a. 1 byte
b. 2 byte
c. 4 byte
d. 8 byte

21. Which among the following is the fundamental data type?

a. integer
b. pointer
c. Array
d. None of these

22. %f specifier is used for which data type?

a. character
b. integer
c. float
d. double

23. %d specifier is used for which data type?

a. character
b. integer
c. float
d. double

24. Size of float data type__________________.

a. 1 byte
b. 2 byte
c. 4 byte
d. 8 byte

25. All keywords in C are in ____________

a. Lower Case letters


b. Upper Case letters
c. Camel Case letters
d. None of the mentioned

26. What is the 16-bit compiler allowable range for integer constants?

BCA Sem I - Question Bank pg. 20


a. -3.4e38 to 3.4e38
b. -32767 to 32768
c. -32668 to 32667
d. -32768 to 32767

27. What is required in each C program?

a. The program must have at least one function.


b. The program does not require any function.
c. Input data
d. Output data

28. How many characters can a string hold when declared as follows?

a. char name[20]:
b. 18
c. 19
d. 20

29. Directives are translated by the_______________.

a. Pre-processor
b. Compiler
c. Linker
d. Editor

30. Compiler generates ______________file.

a. Executable code
b. Object code
c. Assembly code
d. None of the above.

31. C was primarily developed as

a. System Programming Language


b. General Purpose Language
c. Data Processing Language
d. None of the above

32. C was primarily developed as

a. System Programming Language


b. General Purpose Language
c. Data Processing Language
d. None of the above

BCA Sem I - Question Bank pg. 21


33. Standard ANSI C recognizes ________ no of keywords.

a. 30
b. 32
c. 34
d. 24

34. Which is the only function all C program must contains?

a. printf()
b. scanf()
c. main()
d. None of the above

35. C is a which level language.?

a. Low Level
b. High Level
c. Low + High
d. None

36. C is ______________ type of programming language.

a. Object Oriented
b. Procedural
c. Bit level language
d. Functional

37. C language was invented in which laboratory?

a. Uniliver Labs
b. IBM Labs
c. AT&T Bell Labs
d. Verizon Labs

38. C language was invented to develop which Operating System.?

a. Android
b. Linux
c. Ubuntu
d. Unix

39. C language was invented in the year_____________.

BCA Sem I - Question Bank pg. 22


a. 1999
b. 1978
c. 1972
d. 1990

40. C program is a combination of------_____________.

a. Statements
b. Functions
c. Variables
d. All of the above

41. Find an integer constant?

a. 3.145
b. 34
c. 125"
d. None of the above

42. Choose a correct statement.

a. C Compiler converts your C program into machine readable language.


b. C Editor allows you to type C Programs. It is just like a Notepad with extra options.
c. Console shows the output of a C Program if it is text output.
d. All the above

43. What are C ASCII character ranges.?

a. A to Z = 65 to 91
b. a to z = 97 to 122
c. 0 to 9 = 48 to 57
d. All the above

44. Expand or Abbreviate ASCII with regard to C Language.

a. Australian Standard Code for Information Interchange


b. American Standard Code for Information Interchange
c. American Symbolic Code for Information Interchange
d. Australian Symbolic Code for Information Interchange

Module 2 : Operators and Expression, data input & output

1.Which operator is used to assign a value?

BCA Sem I - Question Bank pg. 23


a. &
b. ==
c. !
d. =

2. In C, Arithmetic instruction cannot contain _________________.

a. Variables
b. Constants
c. variable names on right side of =
d. constants on left side of =

3. Which of the following shows the correct hierarchy of arithmetic operations in C?

a. /+*-
b. *- / +
c. +-/*
d. /*+-

4. Which operator is used to find the reminder?

a. &
b. %
c. !
d. =

5. What will be the output of the program?

main( )

int a = 300, b, c ;

if ( a >= 400 )

b = 300;

c = 200;

printf ( "\n%d %d", b, c ) ;

a. 300 200
b. 400 200
c. Garbage value 200
d. None of these

BCA Sem I - Question Bank pg. 24


6. What will be the output of the program?

main( )

int x = 3, y = 5 ;

if ( x == 3 )

printf ( "\n%d", x ) ;

else ;

printf ( "\n%d", y ) ;

a. 5
b. 3 5
c. 3
d. None of these

7. What will be the output of the program?

main( )

int x = 3, y, z ;

y = x = 10 ;

z = x < 10 ;

printf ( "\nx = %d y = %d z = %d", x, y, z ) ;

a. 3 10 0
b. 3 10 1
c. 10 10 0
d. None of these

8. Choose a C Conditional Operator from the list.

a. ?:
b. :?
c. :<

BCA Sem I - Question Bank pg. 25


d. <:

9. What is the other name for the following in C Language ? : Question Mark Colon Operator.?

a. Comparison Operator
b. If-Else Operator
c. Binary Operator
d. Ternary Operator

10. Choose a syntax for C Ternary Operator from the list.

a. condition ? expression1 : expression2


b. condition : expression1 ? expression2
c. condition ? expression1 < expression2
d. condition < expression1 ? expression2

11. Which of the following operators takes only integer operands?

a. +
b. *
c. /
d. %

12. In an expression involving || operator, evaluation

I. Will be stopped if one of its components evaluates to false

II. Will be stopped if one of its components evaluates to false

III. Takes place from right to left

IV. Takes place from left to right

a. I and II
b. I and III
c. II and III
d. II and IV

13. Output of an arithmetic expression with integers and real numbers is ___ by default?

a. Integer
b. Real number
c. Depends on the numbers used in the expression
d. None of the above

14. What is the value of a?

BCA Sem I - Question Bank pg. 26


int a = 10 + 4.867;

a. a = 10
b. a = 14.867
c. a = 14
d. compiler error

15. What is the value of a?

int a = 3.5 + 4.5;

a. a=0
b. a=7
c. a=8
d. a = 8.0

16. What is the value of x?

float x = 3.5 + 4.5;

a. x = 8.0
b. x=8
c. x=7
d. x = 0.0

17. If both numerator and denominator of a division operation in C language are

integers, then we get

a. Expected algebraic real value


b. Unexpected integer value
c. Compiler error
d. None of the above

18. Can you use C Modulo Division operator % with float and int?

a. Only int variables


b. Only float variables
c. int or float combination
d. Numerator int variable, Denominator any variable

19. Associativity of C Operators *, /, %, +, - and = is

a. Operators *, / and % have Left to Right Associativity. Operators + and - have Left to Right
Associativity. Operator = has Right to Left Associativity.
b. Operators *, / and % have Right to Left Associativity. Operators + and - have Left to Right
Associativity. Operator = has Right to Left Associativity.

BCA Sem I - Question Bank pg. 27


c. Operators *, / and % have Right to Left Associativity. Operators + and - have Right to Left
Associativity. Operator = has Right to Left Associativity.
d. Operators *, / and % have Right to Left Associativity. Operators + and - have Right to Left
Associativity. Operator = has Left to Right Associativity.

20. Integer division in a 'C' program results in:

a. Truncation
b. Rounding
c. Underflow
d. None of these

21. In a 'C'expression involving || operator, evaluation

a. Will be stopped if one of its components evaluates to false


b. Will be stopped if one of its components evaluates to true
c. Takes place from right to left
d. None of these

22.What is the other name of Question Mark Colon Operator?

a. Comparison Operator
b. If-Else Operator
c. Binary Operator
d. Ternary Operator

23. In C programming language, which of the following type of operators have the highest
precedence

a. Relational Operators
b. Equality Operators
c. Logical Operators
d. Arithmetic Operators

24. Which of the following comments about the ++ operator are correct?

a. It is a unary operator
b. The operand can come before or after the operator
c. It cannot be applied to an expression
d. All of the above

25. What number will z in the sample code given below?

int z, x = 5, y = -10, a = 4, b = 2;

z = x++ - --y*b/a;

BCA Sem I - Question Bank pg. 28


a. 5
b. 6
c. 9
d. 10

26. Which operator from the following has the lowest priority?

a. Assignment Operator
b. Division Operator
c. Comma Operator
d. Conditional Operator

27. Given b = 110 and c = 20, what is the value of 'a' after execution of the expression a = b = c*=5?

a. 450
b. 10
c. 110
d. -10

28. In C programming language, which of the following type of operators have the highest precedence

a. Relational operators
b. Equality operators
c. Logical operators
d. Arithmetic operators

29. In C programming language, which of the following operator has the highest precedence?

a. Unary +
b. *
c. >=
d. ==

30. If i j,k are integer variable with values 1,2,3 respectively, then what is the value of the expression

a. 6
b. 5
c. 1
d. 0

31. The expression a << 6 shifts all bits of a six places to the left. If a Ox6db7, then what is the value
of a << 6

a. 0xa72b
b. 0xa2b
c. 0x6dc0

BCA Sem I - Question Bank pg. 29


d. 0x1111

32. Choose the correct statements

a. address operator cannot be applied to register variables


b. misuse of register declaration will increase the execution time
c. Both (a) & (b)
d. none of above

33. Choose the correct statement for the given code:

int **a;

a. is illegal
b. is legal but meaningless
c. is syntactically and semantically correct
d. none of these

34.Determine Output:

void main() {

int i = 0, j = 1, k = 2, m;

m = i++ || j++ || k++;

printf("%d %d %d %d", m, i, j, k);

a. 1 1 2 3
b. 1 1 2 2
c. 0 1 2 2
d. 0 1 2 3
35. Determine Output :

void main() {

int c = - -2;

printf("c = %d", c);

a. 1
b. -2
c. 2
d. Error

BCA Sem I - Question Bank pg. 30


Module 3 : Control statements, Loops & Function

1. Loop is used for ____________

a. Selection
b. Decision
c. Repetition
d. None of these

2. How many types of loops are used in C?

a. Two
b. Five
c. Seven
d. Three

3. Which of the following statement is used to take the control to the beginning of the loop?

a. Exit
b. Break
c. continue
d. None of the above

4. The for loop contains ______parts of the expression.

a. 5
b. 3
c. 9
d. 7

5. How many times is a do while loop guaranteed to loop?

a. 0
b. Infinitely
c. 1
d. Variable
6. What is the use of WHILE loop?

a. To repeat the statement finite number of times


b. To repeat the statement until any condition holds true
c. To repeat the statements for infinite time
d. To repeat statements inside until any condition is false

7. The break statement is used to exit from __________.

a. an if statement
b. a for loop

BCA Sem I - Question Bank pg. 31


c. a program
d. the main( ) function

8. A do-while loop is useful when we want that the statements within the loop must be executed:

a. Only once
b. At least once
c. More than once
d. None of the above

9. do-while loop terminates when conditional expression returns?

a. One
b. Zero
c. Non – zero
d. None of the above

10. In what sequence the initialization, testing and execution of body is done in a do-while loop

a. Initialization, execution of body, testing


b. Execution of body, initialization, testing
c. Initialization, testing, execution of body
d. None of the above

11. Choose a correct statement about a C Switch Construct.

a. default case is optional inside switch.


b. break; causes the control to exit the switch immediately and avoid fall down to other CASE
statements.
c. You can not use duplicate CASE Constants inside a Switch construct.
d. All the above.

12. Which of the following cannot be used in switch case statement?

a. Character
b. Integer
c. Float
d. Enum

13. The switch feature

a. can always be replaced by a nested if-then-else clause


b. enhances logical clarity
c. can't always be replaced by a nested if -then-else clause
d. Both (a) and (b)

BCA Sem I - Question Bank pg. 32


14. What is the use of Function ?

a. Helps to avoid repeating a set of statements many times.


b. Helps to avoid repeated programming across programs.
c. Makes the debugging task easier.
d. All of the above

15. In C, parameters are always

a. Pass by value
b. Pass by reference
c. Non-pointer variable are pass by value and pointers are passed by reference
d. Passed by value result

16. How many times will the following loop execute?

for(j = 1; j <= 10; j = j-1)

a. Forever
b. Never
c. 0
d. 1

17. Choose a right C Statement.

a. Loops or Repetition block executes a group of statements repeatedly


b. Loop is usually executed as long as a condition is met
c. Loops usually take advantage of Loop Counter
d. All the above

18. Loops in C Language are implemented using?

a. While Block
b. For Block
c. Do While Block
d. All the above

19. Which loop is faster in C Language, for, while or Do While?

a. for
b. while
c. do while
d. All work at same speed

20. If block always need to be assoicated with a else block?

BCA Sem I - Question Bank pg. 33


a. True
b. False

21. Which of the following is binary operator?

a. &&
b. ||
c. both i & ii
d. !

22. The conditional operator are also known as

a. Relational operator
b. Binary operator
c. Ternary operator
d. Arithematic operator

23.What will be the value of y if x = 8?

y = (x > 6 ? 4 : 6);

a. Compilation Error
b. 0
c. 4
d. 6

24.Which of the following operator reverses the result of expression it operators on

a. !
b. ||
c. &&
d. All of the above

25. The continue statement cannot be used with ________

a. for
b. while
c. do while
d. switch

26. goto can be used to jump from main to within a function?

a. True
b. False

BCA Sem I - Question Bank pg. 34


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

a. if (if (a == 1)){}
b. if (a){}
c. if ((char) a){}
d. if (func1 (a)){}

28. Switch statement accepts

a. int
b. char
c. long
d. All of the above

29. Which loop is guaranteed to execute at least one time?

a. for
b. while
c. do while
d. None of the above

30.A labeled statement consist of an identifier followed by

a. ;
b. :
c. ,
d. =

31.do-while loop terminates when conditional expression returns?

a. One
b. Zero
c. Non - zero
d. None of the above

32. 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 the true
c. it result in a syntax error
d. execution will be terminated abruptly

33. Which of the following statement about for loop is true?

a. Index value is retained outside the loop


b. Index value can be changed from within the loop

BCA Sem I - Question Bank pg. 35


c. Goto can be used to jump, out of the loop
d. All of these

34. Using goto inside for loop is equivalent to using

a. Continue
b. Break
c. Return
d. None of the above

35. A switch statement is used to

a. To use switching variable


b. Switch between function in a programchar
c. Switch from one variable to another variable
d. To choose from multiple possibilities which may arise due to different values of a single
variable

Module 4 : Preprocessor, Storage classes, Arrays

1. What is an Array in C language.?

a. A group of elements of same data type.


b. An array contains more than one element
c. Array elements are stored in memory in continuous or contiguous locations.
d. All the above.

2. Choose a correct statement about C language arrays.

a. An array address is the address of first element of array itself.


b. An array size must be declared if not initialized immediately.
c. Array size is the sum of sizes of all elements of the array.
d. All the above

3. An entire array is always passed by____________to a called function.

a. Call by value
b. Call by reference
c. Address relocation
d. Address restructure

4. What is a multidimensional array in C Language.?

a. It is like a matrix or table with rows and columns


b. It is an array of arrays
c. Both (a) & (b)

BCA Sem I - Question Bank pg. 36


d. None of the above.

5. What are the Types of Arrays.?

a. int, long, float, double


b. struct, enum
c. char
d. All the above

6. Which of the following correctly declares an array?

a. int anarray[10];
b. int anarray;
c. anarray{10};
d. array anarray[10];

7. Which of the following operator can be used to access value at address stored in a pointer variable?

a. *
b. #
c. &&
d. @

8. What are the types of C Preprocessor Directives?

a. Macros
b. Conditional Compilation
c. File Inclusion
d. All the above

9. Processor Directive in C language starts with?

a. $ symbol (DOLLAR)
b. @ symbol (At The Rate)
c. & symbol (Ampersand)
d. # symbol (HASH)

10. Preprocessor in C language works on?

a. DOTC file (.c)


b. DOTEXE file (.exe)
c. DOTH file (.h)
d. DOTCP file (.cp)

11. What is the another name for .C file?

BCA Sem I - Question Bank pg. 37


a. Executable code
b. Source Code
c. Distributable Code
d. Macro code

12. What will be the output of the following C code?

#include <stdio.h>

#define max 100

void main() {

#ifdef max

printf("Hello");

a. 100
b. hello
c. "hello"
d. Error

13. __________ is the Preprocessor directive which is used to end the scope of #ifdef.

a. #elif
b. #ifndef
c. #endif
d. #if

14. What will be the output of the following program?

#include <stdio.h>

#define max 100

void main() {

#if (max%10)

printf("Alg");

#endif

printf("bly");

a. error

BCA Sem I - Question Bank pg. 38


b. Alg
c. bly
d. ALgbly

15.Which of the following is not a storage class specifier?

a. auto
b. register
c. extern
d. volatile
16. What is the inital value of register storage class specifier?

a. 0
b. Null
c. Garbage
d. Infinite

17. What is the scope of extern class specifier?

a. Within block
b. Within Program
c. Global Multiple files
d. None of the above

18. What is the scope of static class specifier?

a. Within block
b. Within Program
c. Global Multiple files
d. None of the above

19. What is the initial value of extern storage class specifier?

a. 0
b. Null
c. Garbage
d. Infinite

20. What will be output for the folowing code?

a. 21
b. 00
c. 32
d. Compilation error

21. What will be output for the folowing code?

BCA Sem I - Question Bank pg. 39


a. 5
b. 6
c. 4
d. Compilation error

22. Which of the following statement are correct?

(I) The maximum value a variable can hold depends upon its storage class.

(II) By default all variables enjoy a static storage class.

a. Only I is correct
b. Only II is correct
c. Both I & II are correct
d. Both I & II are incorrect

23. An identifier's storage class determines

a. The time during which the identifier exists in memory


b. Which function is to use
c. Where to store the program
d. None of them

24. How many storage classes in c?

a. 2
b. 3
c. 4
d. 5

25. Elements in an array are accessed _____________

a. Randomly
b. Sequentially
c. Exponentially
d. Logarithmically

26. Assuming int is of 4bytes, what is the size of int arr[15];?

a. 15
b. 19
c. 11
d. 60

27. In general, the index of the first element in an array is __________

BCA Sem I - Question Bank pg. 40


a. 0
b. -1
c. 2
d. 1

29. What are the disadvantages of arrays?

a. Data structure like queue or stack cannot be implemented


b. There are chances of wastage of memory space if elements inserted in an array are lesser than
the allocated size
c. Index value of an array can be negative
d. Elements are sequentially accessed

30. What are the advantages of arrays?

a. Objects of mixed data types can be stored


b. Elements in an array cannot be sorted
c. Index of first element of an array is 1
d. Easier to store elements of same data type

31. Which of the following concepts make extensive use of arrays?

a. Binary trees
b. Scheduling of processes
c. Caching
d. Spatial locality

32. When does the ArrayIndexOutOfBoundsException occur?

a. Compile-time
b. Run-time
c. Not an error
d. Not an exception at all

33. When does the ArrayIndexOutOfBoundsException occur?

a. Compile-time
b. Run-time
c. Not an error
d. Not an exception at all

34. What is the output of the following Java code?

public class array

BCA Sem I - Question Bank pg. 41


public static void main(String args[])

int []arr = {1,2,3,4,5};

System.out.println(arr[5]);

a. 4
b. 5
c. ArrayIndexOutOfBoundsException
d. InavlidInputException

35. public class array

public static void main(String args[])

int []arr = {1,2,3,4,5};

System.out.println(arr[2]);

System.out.println(arr[4]);

a. 3 and 5
b. 5 and 3
c. 2 and 4
d. 4 and 2

Module 5 : Pointers, Structures and Union , File Handling

1. What is the base data type of a pointer variable by which the memory would be allocated to it?

a. int
b. No datatype
c. Depends upon the type of the variable to which it is pointing
d. unsigned int

2. Prior to using a pointer variable it should be

BCA Sem I - Question Bank pg. 42


a. Declared
b. Initialized
c. Both declared and initalized
d. None of these

3. In C a pointer variable to an integer can be created by the decalaration

a. int p*;
b. int *p;
c. int +p;
d. int $p;

4. A pointer variable can be

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

5. What will be the output of the following C code?

void main() {

int a[] = {1,2,3,4,5}, *p;

p = a;

++*p;

printf("%d ", *p);

p += 2;

printf("%d ", *p);

a. 24
b. 34
c. 22
d. 23

6. what is the output of the following C code?

char *ptr;

char mystring[] = "abcdefg";

ptr = myString;

BCA Sem I - Question Bank pg. 43


ptr += 5;

a. fg
b. efg
c. defg
d. cdefg

7. Will this program compile?

int main() {

char str[5] = "LetsFind";

return 0;

a. True
b. False

8. Is the NULL pointer same as an uninitialised pointer?

a. True
b. False

9. Which of the following statements correct about k used in the below statement?

char ****k;

a. k is a pointer to a pointer to a pointer to a char


b. k is a pointer to a pointer to a pointer to a pointer to a char
c. k is a pointer to a char pointer
d. k is a pointer to a pointer to a char

10. What will be the output of the program.

char *p = 0;

char *t = NULL;

a. Yes
b. No

11. What is the base data type of a pointer variable by which the memory would be allocated to it?

a. int
b. No datatype
c. Depends upon the type of the variable to which it is pointing

BCA Sem I - Question Bank pg. 44


d. unsigned int

12. Prior to using a pointer variable it should be

a. Declared
b. Initialized
c. Both declared and initalized
d. None of these

13. 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;

14.A pointer variable can be

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

15. What will be the output of the following C code?

void main() {

int a[] = {1,2,3,4,5}, *p;

p = a;

++*p;

printf("%d ", *p);

p += 2;

printf("%d ", *p);

a. 24
b. 34
c. 22
d. 23

BCA Sem I - Question Bank pg. 45


16. Will this program compile?

int main() {

char str[5] = "LetsFind";

return 0;

a. True
b. False

17. Is the NULL pointer same as an uninitialised pointer?

a. True
b. False

18. What will be the size of the following structure?

#include <stdio.h>

struct temp {

int a[10];

char p;

};

a. 5
b. 11
c. 41
d. 44

19. What is a structure in C language?

a. A structure is a collection of elements that can be of same datatype


b. A structure is a collection of elements that can be of different datatype
c. Elements of a structure are called members
d. All of the these

20. What is the size of a C structure?

a. C structure is always 128 bytes


b. Size of C structure is the total bytes of all elements of structure
c. Size of C structure is the size of largest elements
d. None of the above

BCA Sem I - Question Bank pg. 46


21. Choose a correct statement about C structure?

int main() {

struct ship {

};

return 0;

a. It is wrong to define an empty structure


b. Member variables can be added to a structure even after its first definition
c. There is no use of defining an empty structure
d. None of the above

22. Choose a correct statement about C structure elements?

a. Structure elements are stored on random free memory locations


b. structure elements are stored in register memory locations
c. structure elements are stored in contiguous memory locations
d. None of the above

23. A C structure or User defined datatype is also called ________.

a. Derived data type


b. Secondary data type
c. Aggregate data type
d. All the above

24. What are the uses of C Structures?

a. structure is used to implement Linked Lists, Stack and Queue data structures
b. Structures are used in Operating System functionality like Display and Input taking
c. Structure are used to exchange information with peripherals of PC
d. All the above

25. Choose a correct statement about C structures.

a. A structure can contain same structure type member


b. A structure size is limited by only physical memory of that PC
c. You can define an unlimited number of members inside a structure
d. All the above

26. Which of the following return-type cannot be used for a function in C?

BCA Sem I - Question Bank pg. 47


a. char *
b. struct
c. void
d. none of the mentioned

27. Which of the following is not possible under any scenario?

a. s1 = &s2;
b. s1 = s2;
c. (*s1).number = 10;
d. None of the mentioned

28. Which one of the following is correct syntax for opening a file.

a. FILE *fopen(const *filename, const char *mode)


b. FILE *fopen(const *filename)
c. FILE *open(const *filename, const char *mode)
d. FILE open(const*filename)

29. What is the function of the mode ‘ w+’?

a. create text file for writing, discard previous contents if any


b. create text file for update, discard previous contents if any
c. create text file for writing, do not discard previous contents if any
d. create text file for update, do not discard previous contents if any

30. If the mode includes b after the initial letter, what does it indicates?

a. text file
b. big text file
c. binary file
d. blueprint text

31. fflush(NULL) flushes all ____________

a. input streams
b. output streams
c. previous contents
d. appended text

32. _____removes the named file, so that a subsequent attempt to open it will fail.

a. remove(const *filename)
b. remove(filename)
c. remove()
d. fclose(filename)

BCA Sem I - Question Bank pg. 48


33.What is the function of FILE *tmpfile(void)?

a. creates a temporary file of mode “wb+”


b. creates a temporary file of mode “wb”
c. creates a temporary file of mode ” w”
d. creates a temporary file of mode “w+”

34.What does tmpfile() returns when it could not create the file?

a. stream and NULL


b. only stream
c. only NULL
d. does not return anything
35.Choose the right statement for fscanf() and scanf()

a. fscanf() can read from standard input whereas scanf() specifies a stream from which to read
b. fscanf() can specifies a stream from which to read whereas scanf() can read only from
standard input
c. fscanf() and scanf() has no difference in their functions
1. fscanf() and scanf() can re

SECTION – B – Two/Three Marks Each

1. What are the different types of Programming languages? Explain


2. Explain about Simple Program Logic with the help of a program.
3. What is Program Development Cycle explain with the help of diagram.
4. What do you understand by desirable program characteristics?
5. Explain the Structure of a program with the help of example.
6. How to Compile and Execute of Program?
7. What is Character Set and identifiers?
8. Explain about Function and Function Prototype.
9. Explain about recursion with the help of program.
10. Write a program to find the roots of quadratic equation.
11. What do you understand by Single character input and output?
12. What is Library functions.
13. What is Operator in C? Name any three operators.
14. Write a Program to calculate and display the volume of a CUBE having its height
(h=10cm), width (w=12cm) and depth (8cm).
15. Write a C program to calculate area and circumference of a circle.
16. Write a C program to perform addition, subtraction, division and multiplication of two
numbers.
17. What is structure in c? Explain the concept of structure with the help of program.

BCA Sem I - Question Bank pg. 49


18. What is Union in c? Explain the concept of structure with the help of program.
19. Explain the concept of For loop in c with the help of program.
20. What is File handling? How to create, read, and delete text files. Write down the
syntax.
21. What is If-else-if statement explain with the help of program and flowchart.
22. Write a program to accept the values of int, float, char data types and display them.
23. Write a C program to find the sum of individual digits of a positive integer.
24. Write a program in C to print the Floyd's Triangle.
25. Write a program in C to print the current time.

SECTION –C – Five Marks Each

1. Explain about Pseudo code Statement and Flowchart symbol with the help of
example.
2. Explain the Evolution of programming Languages.
3. Write a program to take input of name, rollno and marks obtained by a student in 4
subjects of 100 marks each and display the name, rollno with percentage score
secured.
4. Write a program to calculate simple and compound interest.
5. Write a program to swap values of two variables with and without using third variable
6. What do you understand by Decision Making Statement? Write down the syntax of if,
if else, if-else-if ladder using program.
7. What do you mean by Looping Statement? How many types of looping statement
present in c language. Also write down their syntax.
8. Write a Program to Check Whether a Number is Prime or not. 2
9. Write a program to find the largest and smallest among three entered numbers and
also display whether the identified largest/smallest number is even or odd.
10. Write a program to check whether the entered year is leap year or not (a year is leap if
it is divisible by 4 and divisible by 100 or 400.)
11. Write a program to find the factorial of a number.
12. Write a program to check number is Armstrong or not.
13. Write a program to print day name using switch case statement.
14. Write a program to check whether date is valid or not.
15. How to pass arguments to a function? Explain the concept of call by value and call by
reference with the help of program.
16. Write a Program to Search an element in array.
17. Write a Program to perform addition of all elements in Array.
18. Write a Program to find the largest and smallest element in Array.
19. Write a Program to reverse the array elements in C Programming.

BCA Sem I - Question Bank pg. 50


20. Write a Program for deletion of an element from the specified location fromArray.
21. Write a Program to access an element in 2-D Array.
22. Write a program for addition of two matrices of any order in C.
23. Explain about Pointer in c with the help of program.
24. What is nested structure? Explain the concept of nested structure with the help of
program.
25. Differentiate between the structure and union.

SECTION –D – Five Marks Each

1. The total distance travelled by vehicle in 't' seconds is given by distance =


ut+1/2at2 where 'u' and 'a' are the initial velocity (m/sec.) and acceleration
(m/sec2). Write C program to find the distance travelled at regular intervals of time
given the values of 'u' and 'a'. The program should provide the flexibility to the
user to select his own time intervals and repeat the calculations for different values
of 'u' and 'a'.

2. Two integer operands and one operator form user, performs the operation and then
prints the result. (Consider the operators +,-,*, /, % and use Switch Statement)

3. Write a C program to find the factorial of a given integer by using recursive and
non-recursive functions.

4. Write a c- program that uses functions to perform addition and multiplication on


two mattrices.

5. Program That Uses Functions To Delete N – Charactres From A Given Position


In A Given String.

6. Write a program to compute grade of students using if else adder. The grades are
assigned as followed:
a. Marks Grade
b. marks<50 F
c. 50≤marks< 60 C
d. 60≤marks<70 B
e. 70≤marks<80 B+
f. 80≤marks<90 A
g. 90≤mars≤ 100 A+

BCA Sem I - Question Bank pg. 51


7. Write a program That Uses Functions To Insert A Sub-String In To A Given Main
String From A Given Position.

8. Write a program to create a structure named company which has name, address,
phone and noOfEmployee as member variables. Read name of company, its
address, phone and noOfEmployee. Finally display these members‟ value.

9. Define a structure “complex” (typedef) to read two complex numbers and


performaddition, subtraction of these two complex numbers and display the
result.
10. Write a program to read RollNo, Name, Address, Age & average-marks of
12students in the class and display the details from function.

11. Write a program to add two distances in feet and inches using structure.

12. Write a program in C to print first 50 natural numbers using recursion.


The natural numbers are : 1 2 3
4 5 6 7 8 9 10 11 12 13
14 15 16 17 18 19 20 21
22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38
39 40 41 42 43 44 45 46 47
48 49 50

13. Write a program to concatenate two strings using pointers.


14. Write a program to compare two strings using pointers

15. Write a program to create a file called emp.rec and store information abouta person,
in terms of his name, age and salary.

16. Write a program in C to display the multiplication table vertically from 1 to n.

17. Write a C program to merge two files into a third file (i.e., the contents of the first file
followed by those of the second are put in the third.

18. Write programs to display each of the following patterns

BCA Sem I - Question Bank pg. 52


(i) (ii) (iii)1 (iv) A
***** 1 12 AB
**** 22 123 ABC
*** 333 1234 ABCD
** 4444 12345 A BCDE
* 55555

(v) (vi) (vii) (viii)


* ABCDEF
* ******** 1
*** 121 ABCDE
*******
***** 12321 ABCD
***** ABC
******* 1234321
*** A BA
********* 123454321
*

(ix (x)
)1 (xi)
******* (xii)
123 ******
*** *** *****
12345 *
123 ** ** * *
*
1 * * * *
*
* *
* *****
******

19. Write a program to illustrate how to create a file in c?


20. WAP in C Program to count number of lines in a file.

BCA Sem I - Question Bank pg. 53

You might also like