C Programming (OBC 103)
Assignment A
1. What is the basic difference between DVORAK and QWERTY pattern of keyboards? Explain in the context of current market usage.
2. Differentiate between compiler and interpreter
3. Differentiate between compiler and interpreter
4. What do you understand by output device? Explain printer and printing mechanism of character by dot matrix.
5. With the help of a ‘C’ program define call by value and call by reference.
6. What are the different storage classes available in ‘c’? Explain any one of them.
7. What is operator? Define conditional operator with a C program.
8. Write a function that receives 5 integers and returns the sum and the average of these numbers. Call this function from main () and print the results in main ().
9. Write a c Program to count number of characters, number of blanks, and number of words.
Assignment B
Section B - Case Study
QUESTION 1
A 5 digit positive integer is entered through the keyboard, write a function to calculate sum of digits of the 5 digit number:
a) Without using recursion
b) Using recursion
QUESTION 2
Write a recursive function to obtain the first 25 numbers of a Fibonacci sequence. In a Fibonacci sequence the sum of two successive terms gives the third term.
Following are the first few terms of the Fibonacci sequence:
1 1 2 3 5 8 13 21 34 55 89…..
Assignment C
QUESTION 1
Which of the following is not a valid variable name declaration?
- int _a3;
- int a_3;
- int 3_a;
- int _3a
QUESTION 2
Which of the following cannot be checked in a switch-case statement?
- Character
- Integer
- float
- enum
QUESTION 3
What is the problem in following variable declaration?
- The variable name begins with an integer
- The special character -
- The special character?
- All of the mentioned
QUESTION 4
Which data type is most suitable for storing a number 65000 in a 32-bit system?
- signed short
- unsigned short
- long
- int
QUESTION 5
Which of the following is not a unary operators in C?
- !
- sizeof
- ~
- &&
QUESTION 6
enum types are processed by
- Compiler
- Preprocessor
- Linker
- Assembler
QUESTION 7
Who is father of C Language?
- Bjarne Stroustrup
- James A. Gosling
- Dennis Ritchie
- Dr. E.F. Codd
QUESTION 8
Which is more memory efficient?
- structure
- union
- both use same memory
- depends on a programmer
QUESTION 9
Which variables cannot be declared?
- Structure
- Pointer
- Class
- void
QUESTION 10
& means?
- Logical OR
- Bitwise OR
- Logical AND
- Bitwise AND
QUESTION 11
Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3) ?
- Variable
- Function
- typedef
- macros
QUESTION 12
Which of the data types have size that is variable?
- int
- struct
- float
- double
QUESTION 13
Which of the following declaration is not supported by C?
- String str;
- char *str;
- float str = 3e2;
- Both (a) and (c)
QUESTION 14
Which of the following is not a pointer declaration?
- char a[10];
- "char a[] = { 1 , 2 , 3 , 4 };"
- char *str;
- char a;
QUESTION 15
"When double is converted to float, the value is?"
- Truncated
- Rounded
- Depends on the compiler
- Depends on the standard
QUESTION 16
What is the correct value to return to the operating system upon the successful completion of a program?
- 1
- -1
- 0
- Program do not return a value
QUESTION 17
"Find the output of the following program. void main() { int i=01289; printf(""%d"", i); }"
- 289
- 1289
- 713
- syntax error
QUESTION 18
The precedence of arithmetic operators is (from highest to lowest)
- "%, *, /, +, "
- "%, +, /, *, "
- "+, -, %, *, /"
- "%, +, -, *, /"
QUESTION 19
Which of the following data type will throw an error on modulus operation(%)?
- char
- short
- int
- float
QUESTION 20
Which type conversion is NOT accepted?
- From char to int
- From float to char pointer
- From negative int to char
- From double to char
QUESTION 21
"For which of the following, PI++; code will fail?"
- #define PI 3.14
- char *PI = A ;
- float PI = 3.14;
- None of the Mentioned
QUESTION 22
What is the output of this C code? #include void main() { 1 < 2 ? return 1: return 2; }
- returns 1
- returns 2
- Varies
- Compile time error
QUESTION 23
"What is the type of the below assignment expression if x is of type float, y is of type int? y = x + y;"
- int
- float
- There is no type for an assignment expression
- double
QUESTION 24
"For initialization a = 2, c = 1 the value of a and c after this code will be c = (c) ? a = 0 : 2;"
- "a = 0, c = 0;"
- "a = 2, c = 2;"
- "a = 2, c = 2;"
- "a = 1, c = 2;"
QUESTION 25
"What is the output of this C code? #include void main() { char a = 'A'; char b = 'B'; int c = a + b % 3 - 3 * 2; printf(""%d\n"", c); }"
- 65
- 58
- 64
- 59
QUESTION 26
Which of the following operator has the highest precedence in the following?
- ()
- sizeof
- *
- +
QUESTION 27
Switch statement accepts?
- int
- char
- long
- All of the mentioned
QUESTION 28
Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3) ?
- Variable
- Function
- macros
- typedef
QUESTION 29
Which of the following is an invalid if-else statement?
- if (if (a == 1)){}
- if (func1 (a)){}
- if (a){}
- if ((char) a){}
QUESTION 30
Which keyword can be used for coming out of recursion?
- break
- return
- exit
- Both (a) and (b)
QUESTION 31
Which keyword is used to come out of a loop only for that iteration?
- break
- continue
- return
- None of the mentioned
QUESTION 32
goto can be used to jump from main to within a function
- TRUE
- false
- Depends
- Varies
QUESTION 33
The value obtained in the function is given back to main by using ________ keyword?
- return
- static
- new
- volatile
QUESTION 34
What is the problem in the following declarations? int func(int); double func(int); int func(float);
- A function with same name cannot have different signatures
- A function with same name cannot have different return types
- A function with same name cannot have different number of parameters
- All of the mentioned
QUESTION 35
What is the scope of an external variable?
- Whole source file in which it is defined
- From the point of declaration to the end of the file in which it is defined
- Any source file in a program
- From the point of declaration to the end of the file being compiled
QUESTION 36
Which of the following cannot be static in C?
- Variables
- Functions
- Structures
- None of the mentioned
QUESTION 37
Property which allows to produce different executable for different platforms in C is called?
- File inclusion
- Selective inclusion
- Conditional compilation
- Recursive macros
QUESTION 38
A preprocessor is a program
- That processes its input data to produce output that is used as input to another program
- That is nothing but a loader
- That links various source files
- All of the mentioned
QUESTION 39
"Comment on the following pointer declaration? int *ptr, p;"
- "ptr is a pointer to integer, p is not"
- "ptr and p, both are pointers to integer"
- "ptr is a pointer to integer, p may or may not be"
- ptr and p both are not pointers to integer
10 points Save Answer
QUESTION 40
What is prototype of a function in C
- It is the return type of a function
- It is the return data of the function
- It is declaration of a function
- It is a datatype