Which of the following extension is valid for a file containing assembly code?
- .i
- .exe
- .s
- .obj
Show Answer
Answer : Option ( D )Which of the following characteristics is not desired in a good algorithm?
- Abstraction
- Simplicity
- Correctness
- Ambiguity
Show Answer
Answer : Option ( D )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
Show Answer
Answer : Option ( D )Which of the following cannot be a variable name?
- Export
- Volatile
- Friend
- Number 1
Show Answer
Answer : Option ( D )The continue statement cannot be used with
- Switch
- For
- While
- do while
Show Answer
Answer : Option ( A )To stop the execution of a loop, we can use
- exit
- delete
- break
- None of above
Show Answer
Answer : Option ( C )Which loop is guaranteed to execute at least once.
- while.
- do while
- for
- None of above
Show Answer
Answer : Option ( B )Which of the following is unary operator?
- *
- Sizeof
- II
- &&
Show Answer
Answer : Option ( B )Which will be the correct datatype of a variable used for storing the circumference of a circle?
- long int
- short int
- float
- Int
Show Answer
Answer : Option ( C )What are the types of Functions in C Language?
- User Defined Functions
- Library Functions
- Both User Defined and Library Functions
- Basic and Advance Functions
Show Answer
Answer : Option ( C )A function which calls itself is called as
- Auto Function
- Self Function.
- Recursive Function
- None of above
Show Answer
Answer : Option ( C )Choose correct statement about Functions in C Language.
- Every Function may or may not return a value
- 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
Show Answer
Answer : Option ( D )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 Z or a to z.
- All of above
Show Answer
Answer : Option ( D )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
Show Answer
Answer : Option ( B )What will be the output of the following code?
#incIude<stdio.h>
Int main()
int a[3][2]= ((3,1),(6,5),(2,7);
Printf( %d”, a[1][1]*a(2][1]);
- 10
- 35
- 12
- 42
Show Answer
Answer : Option ( B )Consider the array elements 8, 22, 7, 9, 31, 5, 13. Using bubble sort, how many swapping will be done to sort these numbers in ascending order?
- 10
- 12
- 13
- 11
Show Answer
Answer : Option ( A )What will be the output of the following code?
#incIude&lt;stdio.h&gt;
int main()
int a[2][3]=(5, 4, 3, 2, 1);
int i = 0, j = 0;
for (i — 0; j < 2; i++)
for (i = 0; j < 3; j++) printf("%d", a[i][j]); return 0;
- 5 4 3 2 1 garbage-value
- 5 4 3
- 5 4 3 2 1 0
- Compile time error
Show Answer
Answer : Option ( B )The way to pass arrays to functions is
- Pass entire array once
- Pass array element by element
- Both with first and second option
- None of above
Show Answer
Answer : Option ( A )To delete an element from a particular position of a 1D array, the considered index will be
- position-1
- position+1
- Exact at position
- None of above
Show Answer
Answer : Option ( A )What will be the output of the following code?
#incIude<stdio.h>
int main()
int a[10], i;
for(i = 0; i < 10; i++)
printf("%d", a[5]);
- 6
- 4
- S
- Garbage value
Show Answer
Answer : Option ( C )An entire array can be passed to a function by using
- Call by reference
- Call by value
- Call by structure
- Call by array
Show Answer
Answer : Option ( A )Consider an array (45, 77, 89, 90, 94, 99, 100). To search 99 using binary search, what will be the mid values in the first and second iteration?
- 90 and 94
- 90 and 99
- 89 and 94
- 89 and 99
Show Answer
Answer : Option ( B )Consider 1D array as (5, 7, 20, 11, 9, 14). What value will be fetched for a[4]?
- 9
- 11
- 14
- 20
Show Answer
Answer : Option ( A )For the array initialization as, int a[7] = (}; what value will be fetched for a[0]?
- Garbage Value
- O
- -1
- 1
Show Answer
Answer : Option ( B )A pointer that cannot be directly dereferenced and need to be correctly type-casted is called as
- Constant pointer
- Void pointer
- Dangling pointer
- None of above
Show Answer
Answer : Option ( B )What will be the output of the following code?
#incIude<stdio.h>
int main()
int x=35,*p; p=&x;
printf("\n%d",*p);
- Address of x
- 35
- Address of p
- Garbage value
Show Answer
Answer : Option ( B )Malloc and Calloc functions are used for
- Static memory allocation
- Dynamic memory allocation
- Both static and dynamic memory allocation
- None of above
Show Answer
Answer : Option ( B )Which one of the followings is a valid pointer declaration?
- datatype ptrname;
- datatype ptrname*;
- datatype *ptrname;
- datatype *(ptrname*);
Show Answer
Answer : Option ( C )Type of pointer which points to a memory location which is already deleted or deallocated is
- Wild pointer
- Dangling pointer
- Void pointer
- None of above
Show Answer
Answer : Option ( B )A pointer which is not Initialized during its definition and holds some garbage value is called as
- Wild pointer
- Null pointer
- Dangling pointer
- Void pointer
Show Answer
Answer : Option ( A )What will be the output of the following code?
#incIude <stdio.h> int main()
int *ptr, num = 15; ptr = #
*ptr += 1;
printf( /d, %d", *ptr, num);- 15, 16
- 16, 15
- 16, 16
- 15, 15
Show Answer
Answer : Option ( C )The correct syntax of typecasting in void pointers is
- *(data type*) pointer name;
- (data_type*) pointer _name;
- *(data type) pointer name;
- *(data_type)*pointer _name;
Show Answer
Answer : Option ( B )Library functions which can be used for dynamic memory allocation are
- maloc() and caloc()
- alloc() and memalloc()
- malloc() and memalloc()
- malloc() and calloc()
Show Answer
Answer : Option ( D )Which of the following statement is correct for: int *ptr, pnum:
- ptr and pnum, both are pointers to integer
- ptr is a pointer to Integer, pnum is not
- ptr and pnum both are not pointers to Integer
- ptr is a pointer to integer, pnum may or may not be
Show Answer
Answer : Option ( B )Which one of the following is correct string initialization?
- char name[] = "LPU";
- char name[] = ( 'L', 'P', 'U', ’\0’ };
- char* nameptr = "LPU";
- all of above
Show Answer
Answer : Option ( D )We can access union members as
- union_pointer--->member
- union_name. member
- union_name@ member
- both union pointer--->member and union_name. member
Show Answer
Answer : Option ( B )Keyword used to define union in C is
- Union
- Uni o
- union (All small characters)
- None of above
Show Answer
Answer : Option ( C )To free the memory allocated by malloc function, we can use
- free(ptr)
- free ptr;
- free(ptr);
- free ptr";
Show Answer
Answer : Option ( A )Structure name is connected with its member name by using
- hyphen
- dot
- underscore
- none of above
Show Answer
Answer : Option ( B )Keyword used to define structure in C is
- struct (all small characters)
- Struct
- Str
- structure
Show Answer
Answer : Option ( A )To copy content of one string into another, we can use
- strcopy()
- stcpy()
- stringcopy()
- strcpy()
Show Answer
Answer : Option ( D )What will be the output of the following code?
#incIude<stdio.h>
int main()
char arr[] = "Computer Science";
printf( %s", arr);
- Computer Science
- Compiler error
- Nothing will be printed
- Program will crash
Show Answer
Answer : Option ( A )To copy a specific number of characters from one string to another, the function used is
- Stropy
- strncpy (all small characters)
- Strncpy
- strcpyn
Show Answer
Answer : Option ( B )The return type of malloc() and calloc() functions is
- Int*
- Char*
- Float*
- Void*
Show Answer
Answer : Option ( D )Extension of expanded source code file is
- .obj
- .i
- .s
- .exe
Show Answer
Answer : Option ( B )C language was developed in
- 1970
- 1965
- 1972
- 1971
Show Answer
Answer : Option ( A )What will be the output of the following code?
#incIude<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
- 3O
- 32
Show Answer
Answer : Option ( D )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
Show Answer
Answer : Option ( B )If the size of 1D array is 50, then last index of the array will be
- 50
- 48
- O
- 49
Show Answer
Answer : Option ( D )Pointer arithmetic can not be performed on
- Null pointer
- Wild pointer
- Void pointer
- Constant pointer
Show Answer
Answer : Option ( A )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
Show Answer
Answer : Option ( B )For dynamic memory allocation functions, we need to include
- memory.h
- stdli
- h
- stdio.h
- conio.h
Show Answer
Answer : Option ( B )To join two words, which C function will be used?
- strcalt()
- strcon()
- strcat()
- merge()
Show Answer
Answer : Option ( C )The format specifier used to print a string or character array in C is
- %S
- %c
- %s
- %C
Show Answer
Answer : Option ( C )How the size of a 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
Show Answer
Answer : Option ( A )What will be the output of the following code?
#incIude<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
Show Answer
Answer : Option ( A )For dynamic memory allocation functies, we .........
- memory.h
- stdli
- h
- stdio.h
- conio.h
Show Answer
Answer : Option ( B )What will be the output of the following code?
int main()
char arr1[10]="LPU";
char arr2[5]; arr2= arr1; printf("%s",arr2);
- Compiler error
- LPU
- LPU\0
- None of above
Show Answer
Answer : Option ( D )What will be the output of the following code?
#incIude<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
Show Answer
Answer : Option ( D )
CSE101 Ete Exam Answer Key
July 20, 2022
0
Tags