Vous êtes sur la page 1sur 14

BC0034

COMPUTER CONCEPTS & C PROGRAMMING


(1 mark each)
1) Which of the following statements is true? a) C Library functions provide I/O facilities b) C inherent I/O facilities c) C doesnt have I/O facilities d) Both (a) and (c) 2) Header files in C contain a) Compiler commands b) Library functions c) Header information of C programs d) Operators for files 3) Which pair of functions below are used for single character I/O. a) Getchar() and putchar() b) Scanf() and printf() c) Input() and output() d) None of these 4) The printf() function retunes which value when an error occurs? a) Positive value b) Zero c) Negative value d) None of these 5) Identify the wrong statement a) putchar(65) b) putchar('x') c) putchar("x") d) putchar('\n') 6) The output of printf("%u", -1) is a) -1 b) minimum int value c) maxium int value d) Error message

7) An Ampersand before the name of a variable denotes a) Actual Value b) Variable Name c) Address d) Data Type 8) Symbolic constants can be defined using a) # define b) const c) symbols d) None of these 9) Null character is represented by a) \n b) \0 c) \o d) \e 10) Which header file is essential for using strcmp() function? a) string.h b) strings.h c) text.h d) strcmp.h 11) malloc() function used in dynamic allocation is available in which header file? a) stdio.h b) stdlib.h c) conio.h d) mem.h 12) File manipulation functions in C are available in which header file? a) streams.h b) stdio.h c) stdlib.h d) files.h 13) C supports how many basic looping constructs a) 2 b) 3 c) 4 d) 6 14) A statement differs from expression by terminating with a a) ;

b) : c) NULL d) . 15) What should be the expression return value for a do-while to terminate a) 1 b) 0 c) -1 d) NULL 16) Which among the following is a unconditional control structure a) do-while b) if-else c) goto d) for 17) continue statement is used a) to go to the next iteration in a loop b) come out of a loop c) exit and return to the main function d) restarts iterations from beginning of loop 18) Which operator in C is called a ternary operator a) if..then b) ++ c) ?: d) () 19) Which of the following header file is required for strcpy() function? a) string.h b) strings.h c) files.h d) strcsspy() 20) The meaning of conversion character for data input is a) Data item is a long integer b) Data item is an unsigned decimal integer c) Data item is a short integer d) None of the above 21) The conversion characters for data input means that the data item is a) An unsigned decimal integer b) A short integer c) A hexadecimal integer d) A string followed by white space

22) Which of the following is a key word is used for a storage class a) printf b) external c) auto d) scanf 23) In the C language 'a represents a) a digit b) an integer c) a character d) a word 24) The number of the relational operators in the C language is a) Four b) Six c) Three d) One 25) A compound statement is a group of statements included between a pair of a) double quote b) curly braces c) parenthesis d) a pair of /s 26) A Link is a) a compiler b) an active debugger c) a C interpreter d) a analyzing tool in C 27) The continue command cannot be used with a) for b) switch c) do d) while 28) In C, a Union is a) memory location b) memory store c) memory screen d) None of these 29) When the main function is called, it is called with the arguments a) argc

b) argv c) None of these d) both a & b 30) A multidimensional array can be expressed in terms of a) array of pointers rather than as pointers to a group of contiguous array b) array without the group of contiguous array c) data type arrays d) None of these 31) C allows arrays of greater than two dimensions, who will determined this a) programmer b) compiler c) parameter d) None of these 32) A pointer to a pointer in a form of a) multiple indirection b) a chain of pointers c) both a and b d) None of these 33) Pointers are of a) integer data type b) character data type c) unsigned integer data types d) None of these 34) Maximum number of elements in the array declaration int a[5][8] is a) 28 b) 32 c) 35 d) 40 35) If the size of the array is less than the number of initializers then, a) Extra values are being ignored b) Generates an error message c) Size of Array is increased d) Size is neglected when values are given 36) Array subscripts in C always start at a) -1 b) 1 c) 0 d) Value provided by user

37) A Structure a) can be read as a single entity b) cannot be read as a single entity c) can be displayed as a single entity d) has member variables that cannot be read individually 38) Identify the invalid pointer arithmetic a) Addition of float value to a pointer b) Comparision of pointers that do not point to the element of the same array c) Subtracting an integer from a pointer d) Assigning the value 0 to a pointer variable 39) Which is the correct way to declare a pointer? a) int_ptr; b) int *ptr; c) *int ptr; d) None of these. 40) If you want to exchange two rows in a two dimensional array, the fastest way is to: a) Exchange the elements of the 2rows b) Exchange the address of each element in the two row] c) Silence the address of the rows in an array of pointer and exchange the pointer d) None of these.

(2 marks each)
41) The precedence of the C operators dictates the order of evaluation within an expression i.e. _____________ and ________________(left to right, right to left). 42) The C language is accompanied by a number of _______________or ______________ functions (library, built-in) 43) The _____________and _____________ functions facilitate the transfer of strings between the computer and the standard input/output devices.(gets,puts) 44) Accessing members of a union is via ________ member operator or, for pointers to unions, the _______ operator. (.(dot), ->) 45) True/False 1. We can not write a function that returns the structure. (False) 2. We can modify a member of the structure by passing the structure as an argument. (True)

46) True/False 1. Array is a method for packing data of different types. (False) 2. If Person1 and Person2 are variables of same type structure then expression P1>P2 is valid. (False) 47) True/False 1. Pointer is a variable containing the address of another variable. (True) 2. We can declare structure variables using tag name anywhere in program. (True) 48) A __________ operator applies to two operands, while a _________ operator applies to a single operand. (Binary, Unary) 49) The * operator is _____________ when it sits between two variables, and it is the ___________ when it sits in the front of a single variable. (Multiplication operator, contents-of-operator). 50) An ____ is a data structure whose elements are all of the same data type, while ______ is a data structure whose elements can differ in type. (Array, Structure). 51) True/False 1. Strings must be represented as an array of characters in C. (True) 2. When you pass an array as a parameter to a function, the entire array is copied and is available to function. (False). 52) The standard librarys _________ function compares two strings, while ________ function copy one string to another. (strcmp, strcpy) 53) True/False 1. Complier doesnt allocate memory for an external variable where it is accessed (T) 2. Global variables and external variables have the same scope. (False) 54) True/False 1. The main purpose of the function is to save time. (False) 2. A stopping condition must be there in a recursive definition. (True) 55) True/False 1. C Programs are highly portable. (True) 2. C compliers are commonly available for computers of all sizes. (True) 56) True/False 1. Every C program must have one main() function. 2. The main () function doesnt return any value. (True) (False)

57) The ___________ are symbols that represent information being passed between the function and the other parts of the program. They appear in the ___________ (arguments, function heading)

58) A _______ is a place where we can store values. Size of int is __ bits. (Variable, 16). 59) Variables consist of letters, numbers and ______________. You may not use _________ (underscore, keyword) 60) __________ Operator can be only applied to integers. The value 14%3 + 7%2 is ___________. (%, 3)

(4 marks each)
61) Study the following C program : #include <stdio.h> #define F(a,b) (a+b)* (a*a+2*a*b+b*b) main() { int i, j, sum; I=j=sum=1; for(i=0;i<2;i++) sum=sum+F(i,j); printf(\n Sum = %d,sum); } What will be the value of n after the execution of the above program? a) b) c) d) 11 12 10 None of the above

62) Study the following C program: #include <stdio.h> main() { int sum=1, count=1 do { count ; sum=3*sum; } while (count>5); } What will be the value of n after the execution of the above program ? a) 1 b) 0 c) 3 d) None of the above 63) Study the following C program :

#include <stdio.h> #include <string.h> main() { char *str1, *str2, *str3; str1=India is My; str2=!!yrtnuoC; str3=Gujrat; clrscr(); strncat(str1,strrev(str2),strlen(str3)); puts(str1); } What will be the value of n after the execution of the above program ? a) b) c) d) India is My Country!! India is My !!yrtnuoC India is My Country None of the above

64) Study the following C program : #include <stdio.h> main() { int count, digit=0; count=1; while(digit<=9) { printf(%d\n,++count); ++digit; } } What will be the value of n after the execution of the above program ? a) b) c) d) 10 9 11 12

65) Study the following C program : #include <stdio.h> main() { int i, j, k; j=5; i=2*j/2; k=2*(j/2); printf(I=%d , k=%d,i,k); }

What will be the value of n after the execution of the above program ? a) b) c) d) I=5, k=5 I=4, k=4 I=5, k=4 I=4, k=5

66) Study the following C program : #include <stdio.h> main() { int a,b,c; b=2; a=2; a=2*(b++); c=2*(++b); printf(a=%d , c=%d,a,c); } What will be the value of n after the execution of the above program ? a) b) c) d) a=4, c=6 a=3, c=8 a=3, c=6 a=4, c=8

67) Study the following C program : #include <stdio.h> main() { int *iptr, i; i=12; *iptr=i * i; ++i; printf(%d %d\n,i,*iptr); } What will be the value of n after the execution of the above program ? a) b) c) d) 12 144 13 144 13 0 None of the above

68) Study the following C program : #include <stdio.h> main() { int a=0; while (a<5)

{ sum(a); a++; } void sum(int a) { static kk; printf (%d,kk+a); kk++; } What will be the value of n after the execution of the above program? a) b) c) d) 02468 01234 13579 12345

69) Study the following C program: #include <stdio.h> int arr[]={1,2,3, 4} main() { int a, *ptr, b,c; a=51%26; ptr=&a; a+=2; b=arr[1]+a; c=*ptr+b; printf(%d %d %d,a,b,c); } What will be the value of n after the execution of the above program? a) b) c) d) 27 29 54 25 27 52 27 28 53 27 29 56

70) Study the following C program: main() { int a; printf(enter a); scanf(%d,&a); switch(a) { case 1: printf(One); case 3: printf(Three); case 5: printf(Five);

default: printf(Odd); break; } What will be the value of n after the execution of the above program when input is 3 ? a) b) c) d) ThreeFiveOdd Three Five Odd

71) Study the following C program: main() { union { int i; float f; double d; }u; printf(%d,sizeof(u)); } What will be the value of n after the execution of the above program? a) b) c) d) 8 6 12 10

72) Study the following C program: main() { int n=5; int fun(int n); printf(%d\nfun(n)); } int fun (int n) { if (n==0) return 0; else return(n+fun(n-1)); } What will be the value of n after the execution of the above program?

a) b) c) d)

5 25 15 10

73) Study the following C program: main() { int i=0, x=0; do { if (i%5==0) x++; ++i; } while (i<20); printf(X=%d,x); } What will be the value of n after the execution of the above program? a) b) c) d) X=4 X=20 X=25 X=10

74) Study the following C program: main() { int i=0, x=0; while (i<20) { if (i%5==0) x+=i; i++; } printf(X=%d,x); } What will be the value of n after the execution of the above program? a) b) c) d) X=30 X=20 X=25 X=10

75) Study the following C program : #include <stdio.h> main() { int i, n=2;

for(i=0;I<2;i++) { if(!(i<=n)&&(++n==i)) n=n+2; else n=n-2; } } What will be the value of n after the execution of the above program? a) b) c) d) 3 4 2 None of the above

Vous aimerez peut-être aussi