1. Which of the following extension is valid for a file containing assembly code?
- .i
- .exe
- .s
- .obi
Ans: .obj
2. Which of the following characteristics is not desired in a good algorithm?
- Abstraction
- Simplicity
- Correctness
- Ambiguity
Abs: Ambiguity
3. Role of pre-processor is to
- Detect semantic error
- Generate source code
- Combine various object files and library files
- Include the code of header files at the point, where they are included to general expanded source code
Ans: Include the code of header files at the point, where they are included to general expanded source code
4. Which of the following cannot be a variable name?
- Export
- Volatile
- Friend
- Number 1
Ans: Number 1
5. The continue statement cannot be used with
- Switch
- For
- While
- do while
Ans: Switch
6. To stop the execution of a loop, we can use
- exit
- delete
- break
- None of above
Ans: break
7. Which loop is guaranteed to execute at least once.
- while.
- do while
- for
- None of above
Ans: do while
8. Which of the following is unary operator?
- *
- Sizeof()
- II
- &&
Ans: Sizeof()
9. Which will be the correct datatype of a variable used for storing the circumference of a circle?
- long int
- short int
- float
- Int
Ans: float
10. What are the types of Functions in C Language?
- User Defined Functions
- Library Functions
- Both User Defined and Library Functions
- Basic and Advance Functions
Ans: Both User Defined and Library Functions
11. A function which calls itself is called as
- Auto Function
- Self Function.
- Recursive Function
- None of above
Ans: Recursive Function
12. Choose correct statement about Functions in C Language.
- Every Function may or may not return a valuue
- A Function is a group of C statements which can be reused any number of times.
- Every Function has a return type
- All of above
Ans: All of above
13. What will be the output of the following code?
int main(){
char arr1[10]="LPU";
char arr2(51;
arr2 arr1;
printf("%s",arr2)
}
- Compiler error
- LPU
- LPU\O0
- None of above
Ans: None of above
14. What will be the output ofthe following code?
#include<stdio.h>
int main(){
int *ptr1;
char *ptr2;
float *ptr3;
printf("n%d",sizeof(ptr1);
printf("n%d",sizeof(ptr2));
printf("n%d",sizeof(ptr3));
}
- 16 16 16
- 2 2 2
- 4 4 4
- 8 8 8
Ans: 8 8 8
15. For dynamicmemory allocation functies, we.
- memory.h
- stdlib.h
- stdio.h
- conio..h
Ans: stdlib.h
16. What wll be the output ofthe following code?
#include<stdio.h>
int main(){
Int num 1 = 10, num2 = 20;
Int const ptr=&num1;
printf("n%d" "ptr);
ptr = &num2;
printf("%d\n", "ptr);
}
- Error
- 10 20
- 10
- 20
- Infinite loop
Ans: Error
17. How the size ofa union in C is determined?
- by the size of biggest member in union
- by the size of first member in union
- by the size of last member in union
- by summing the sizes of all members in union
Ans: by the size of biggest member in union
18. The format specifier used to print a string or character array in C is
- %5
- %c
- %s
- %C
Ans: %s
19. To join two words, which C function will be used?
- strcalt()
- strcon()
- strcat()
- merge()
Ans: strcat()
20. For dynamic memory allocation functions, we need to include
- memory.h
- stdlib.h
- stdio.h
- conio.h
Ans: stdlib.h
21. What is the formula for elastic force?
- Elastic strain/area
- Elastic stress/area
- Elastics stress* Elastic strain
- Elastic stress* area
Ans: Elastic stress* area
Introduction:
Elasticity is the property of the material which resists change in its shape.
elastic force is the force which material is required to come back in its original shape.
Elastic force is a force that is developed by a material to retain to its original position. It regains its shape after a period of time. When an elastic material is compressed or stretched, it develops an elastic force.
22. Mach Number is the Ratio of –
- Inertia forces to Compressibility forces
- Inertia forces to viscous forces
- Inertia forces to Gravity forces
- Buoyancy forces to Inertia forces
Ans: Inertia forces to viscous forces
23. Pointer arithmetic can not be performed on
- Null pointer
- Wild pointer
- Void pointer
- Constant pointer
Ans: Null pointer
24. If the size of 1D array is 50, then last index of the array will be
- 50
- 48
- 0
- 49
Ans: 49
25. To insert an element in 1D array at a particular position, the considered index will be
- exact at position
- position+1
- position-1
- None of above
Ans: position+1
26. What will be the output of the following code?
#include<stdio.h>
int main(){
Int a[5]={7,32,30,48,51};
a[2]-a[1];
a[3]-a[2];
a[4]=a[3];
printf("%d",a[4]);
}
- 51
- 48
- 30
- 32
Ans: 32
27. C language was developed in
- 1970
- 1965
- 1972
- 1971
Ans: 1970
28. The return type of malloc() and calloc() functions is
- Int*
- Char*
- Float*
- Void*
Ans: Void*
29. To copy a specific number of characters from one string to another, the function used is
- Stropy
- strncpy (all small characters)
- StrncPy
- strcpyn
Ans: strncpy (all small characters)
30. What will be the output of the following code?
#include<stdio.h>
int main(){
char arrll= "ComputerScience";
printf("%s", arr);
}
- Computer Science
- Compiler error
- Nothing will be printed
- Program will crash
Ans: Computer Science
31. To copy content of one string into another, we can use
- strcopy()
- stcpy()
- stringcopy()
- strcpy0
Ans: strcpy()
32. Keyword used to define structure in C is
- struct (all small characters)
- Struct
- Str
- structure
Ans: struct (all small characters)
33. Structure name is connected with its member name by using
- hyphen
- dot
- underscore
- none of above
Ans: dot
34. To free the memory allocated by malloc function, we can use
- free(ptr)
- free ptr;
- free(ptr);
- free ptr”;
Ans: free(ptr)
35. Keyword used to define union in C is
- Union
- Uni_o
- union (All small characters)
- None of above
Ans: union (All small characters)
36. We can access union members as
- union_pointer–>member
- union_name. member
- union_name@ member
- both union_pointer–>member and union_name. member
Ans: union_name. member
37. Which one of the following is correct string initialization?
- char name] = “LPU”;
- charname] = {‘L, P’, ‘U’, “\0′
- char nameptr = “LPU”;
- all of above
Ans: all of above
38. Choose the correct statement about Functions of C Language.
- Default return type of any function is an Integer
- A function name cannot be same as a predefined C Keyword
- A function name can start with an Underscore (-)or A to Zor a to z.
- All of above
Ans: All of above
39. How many values can a C Function return at a time?
- Maximum of two values
- Only One Value
- Maximum of five values
- Any number of values
Ans: Only One Value