C Programming K1

C Programming K1

DEPARTMENT OF COMPUTER TECHNOLOGY 18 UCT 101 - C PROGRAMMING K1 - Level Questions Unit - I 1) which operator are used to compare the values of operands to produce logical value in C language? a) logical operator b) relational operator c) assignment operator d) none of the above 2) What is/are the type/types of numeric constant /constants used in a C programming language? a) integer constant b) real constant c) both(a)&(b) d) none of the above 3) Rules for identifier or word. First character must be an a) integer b) alphabet c) special character d) none of the above 4) Who developed the C programming language a) Bjarne Stroustrup b) James Gosling c) Dennis Ritchie d) Ray Boyce 5) The operator “&” is used for a) bitwise AND b) bitwise OR c) logical AND d) logical OR 6) Which are built-in data structures in C programming? a) arrays b) structure c) files d) all of the above 7) The words if, else, auto, float, etc. have predefined meaning and users cannot use them as variables. These words are called a) constant b) identifier c) data types d) keywords 8) To read an integer data for variable a a) scanf(“%d”,&a) b) printf(“%d”,&a) c)printf(“%f”,&a) d)scanf(“%f”,&a) 9) The size of a character variable in C is a) 8 bytes b) 4 bytes c)2 bytes d) 1 byte 10) Complete statements must be enclosed by the braces a) {} b) () c) [] d) <> Unit - II 1.Which of the following is not a valid variable name declaration? a) float PI = 3.14; b) double PI = 3.14; c) int PI = 3.14; d) #define PI 3.14 2.Which of the following cannot be a variable name in C? a) volatile b) true c) friend d) export 3.Which keyword can be used for coming out of recursion? a) break b) return c) exit d) both break and return 4.The keyword „break‟ cannot be simply used within _________ a) do-while b) if-else c) for d) while 5.Which keyword is used to come out of a loop only for that iteration? a) break b) continue c) return d) none of the mentioned 6.Which datatype can accept switch statement? a) int b) char c) long d) all of the mentioned 7.The C code „for(;;)‟ represents an infinite loop. It can be terminated by ___________ a) break b) exit(0) c) abort() d) terminate 8.Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)? a) Variable b) Function c) typedef d) macros 9.What is an example of iteration in C? a) for b) while c) do-while d) all of the mentioned 10.Which loop is most suitable to first perform the operation and then test the condition? a) for loop b) while loop c) do-while loop d) none of the mentioned Unit - III 1. A string is collection of ………………………. a.integers b.characters c.variables d.constant 2.Which standard library function will you use to find the last occurance of a character in a string in C? a. strnchar() b. strchar() c. strrchar() d. strrchr() 3.Which of the following function sets first n characters of a string to a given character? a.strinit() b.strnset() c.strset() d.strcset() 4.The library function used to reverse a string is a.strstr() b.strrev() c.revstr() d.strreverse() 5.If the two strings are identical, then strcmp() function return a.-1 b.1 c.0 d.Yes 6.How will you print on the screen? a.printf(""); b.echo ""; c.printf(''); d.printf(""); 7.Which of the following function is more appropriate for reading in a multi-word string? a.printf(); b.scanf(); c.gets(); d.puts(); 8. is used to call the function. a. Variable b. User defined type c. Function name Return type 9.Which is used to compare two strings? a. strlen() b. strcpy() c. strcat() d. strcmp() 10. A string that always ends with . a. \0 b. \n c. \b d. \t Unit- IV 1. User defined data type can be derived by . a) struct b) enum c) typedef d) all of the above 2. Which of the following is correct syntax to send an array as parameter to function? a) func(&array); b) func(#array); c) func(*array); d) func(array[size]); 3. Which operator is used to obtain a variable? a) * b) & c) . d) || 4. Which of the following return type cannot be used for a function c? a)char* b) struct c) void d) none of the above 5. Which operator connects the structure name to its member name? a)- b) <- c) . d) both b and c. 6. Memory is divided into small pieces is called a) bytes b) bits c) pieces d) items 7. A pointer is . a) a keyword to create variable. b) a variable that stores address of an instruction. c) a variable that stores address d) all of the above. of other variable. 8. Which of the following operator is illegal in structures? a) type casting of structure. b) pointer to a variable of same structure. c) dynamic allocation of memory d) all of the above. for structure. 9. What is (void*)? a) representation of NULL pointer. b) representation of void pointer. c) error. d) none of the above. 10. provide an efficient way of using same memory location for multiple purpose. a) structure b) array c) functions d) union. Unit - V 1. What is the value of EOF? a)-1 b)0 c)1 d)10 2. For binary files, a -------------- must be appended to The mode string. a)Nothing b)”b” c)”binary” d)10 3. If there is any error while opening a file, fopen Will return a) EOF b)NULL c)Nothing d)depends on complier 4.File is of ---------- type a)int type b)char*type c)struct type d)none 5. Which type of files cant be opened using fopen()? a).txt b).bin c).c d)none 6. A data of the file is stored in ----------- a)ram b)hard disk c)rom d)none 7. Select a function which is used to read a single character from a file at a time? a)fscanf() b)getch() c)fgetc() d)fgets() 8. Which is data type of file pointer ----------- a)int b)double c)void d)file 9. Select text file in which data is stored in------- a)ASCII code b)binary code c)octal code d)text code 10. Text file in which number will take--------bytes. a)2 bytes b)4 bytes c)3 bytes d)8 bytes *************************************************************************** DEPARTMENT OF COMPUTER TECHNOLOGY C PROGRAMMING K2 - Level Questions Unit - I 1. Explain continue statement 2. Write any four data types. 3. Define a variable. 4. What are the key words? 5. Which is enclosed by double quotes? 6. What is a string? 7. What are the logical operators? 8. How to check the value of a particular bit? 9. Define a type casting. 10. What is character set? Unit - II 1. Classification of control statements. 2. Write about go-to statement. 3. Define array. 4. How to declare an array. 5. What is looping. 6. Write about unconditional statement. 7. Define switch statement. 8. Write Syntax for for loop. 9. Write Syntax for nested if. 10. Write about array index out of bounds. Unit - III 1. What is function? 2. Explain return statement. 3. What is palindrome? 4. Write about parameter? 5. How will you read a string? 6. What are the types of function? 7. Write about string and its example. 8. Explain user defined function. 9. What advantages of return statement? 10. Write a string and find its reverse using string library function. Unit -IV 1. What is pointer? 2. Define function. 3. Define structure. 4. Write general format of type definition. 5. Give two advantages of union. 6. What the operator used in call by reference method. 7. Is the call by reference use variable indirectly? 8. Define indirection operator. 9. Write a types of pointer variable. 10. Give some advantages of pointers. Unit - V 1. Define file. 2. How to open and close a file? Write its syntax. 3. Write the operations in a file. 4. How to declare a variable in a file? 5. What are the two command line arguments? 6. Define ftell(); 7. What are the library functions? 8. Define pre-processor. 9. What is command line argument? 10. Which is used to read a group of characters? *************************************************************************** DEPARTMENT OF COMPUTER TECHNOLOGY C PROGRAMMING K3 - Level Questions Unit - I 1. Write about constants and its types with examples. 2. What are the advantages of C Language? 3. How will you declare a variable? 4. Describe about Library functions in C programming. 5. Explain the rules and naming convention for the identifier. 6. Write a note on sizeof () operator. 7. Explain the block structure of C programming. 8. Describe about evaluation of an expression and precedence of operators. 9. Write a C program to check whether a number is prime or not. 10. Explain about relational operators with examples. Unit - II 1. What is pre-increment/post-increment? Explain with example. 2. Explain about break statement with examples. 3. Difference between while and do… while Loop with examples. 4. Explain about switch case with suitable program. 5. Write about Continue statement with examples. 6. Write a C program to perform transpose of matrix. 7. How will you declare an array variable? Explain it.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    521 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us