Вы находитесь на странице: 1из 3

1. What type value do the following functions return?

int print_error( float err_nbr);


.
a) error b) nothing c) int d) float
2. To what value does the expression 5+3*8/2+2 evaluate
a) 19 b) 20 c) 18 d) 21
3. An consists of variables, constants, and operators combined to perform some useful
computation.
a) expression b) statement c) program d) none
4. This format specifer causes printf to display 6 decimal places
1) lf 2) lg 3)le 4) none
5. Linker errors are relatively rare and usually result from misspelling the name of a C
.function.
6. enum colors {BLACK,BLUE,GREEN}
main()
{ printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1);}
output of this program will be.
a) BLACK,BLUE,GREEN b) 0,1,2 c) nothing d) error
7. void main()
{
char far *farther,*farthest;
printf("%d..%d",sizeof(farther),sizeof(farthest));
}
output of this program will be.
a) 4,2 b) 0,1 c) nothing d) error
8. main( )
{
void *vp;
char ch = g, *cp = goofy;
int j = 20;
vp = &ch;
printf(%c, *(char *)vp);
vp = &j;
printf(%d,*(int *)vp);
vp = cp;
printf(%s,(char *)vp + 3);
}
output of this program will be.
a) goofy b) 20 c) g20fy d) error

9. # include<stdio.h>
aaa() { printf("hi"); }
bbb(){ printf("hello"); }
ccc(){ printf("bye"); }
main()
{
int (*ptr[3])();
ptr[0]=aaa;
ptr[1]=bbb;
ptr[2]=ccc;
ptr[2]();
}
output of this program will be.
a) hello b) bye c) nothing d) error

10.main()
{
char *p = ayqm;
printf(%c,++*(p++));
}
output of this program will be.
a) ayqm b) b c) y d) error

Fill in Blanks
1. The ..includes a return type indicating the type of variable that the function
will return.
2. Every C program contains at least the function which is the first
function executed when the program starts. All other functions are subroutines.
3. Type . is used when you want to convert the value of a variable from one
type to another.
4. After a .. statement, the control returns to top of the loop, that is, to the
test conditions. .. loop doesn't have a continue statement.
5. .is a composite type similar to structure. Even though it has members of
different data types, it can hold data of only one member at a time
6. .. keyword to create a synonym for a structure or union type.
7. An array is declared with the following statement. How many total elements does the
array have?
int array[2][3][5][8];
8. void *.(size_t size);
() allocates a block of memory that is the number of bytes stated in size.
9. An .. variable is a variable defined outside of any function. A .
variable is one that is defined within a function.
10. C has three loop statements that control program execution: ,
.., and ..
T/f
1. The remainder operator requires that both operands be integers
2. The value of an expression can be converted to a different data type if
desired
3. Functions can only pass pointers and not arrays.
4. sizeof operator is a unary operator.
5. The actual value of the symbolic constant needs to be entered only once,
when it is first defined.
6. When the compiler converts the source code to object code, it throws the
comments and the white space away.
7. The variable name cant contain letters, digits, and the underscore
character (_).
8. The identifier count and Count refer to two different variables.
9. C is case sensitive all keyword and standard library functions are lowercase.
10. Is the following code segment is right ? while ((fgets(receiving
array,50,file_ptr)) != EOF)

1. Write a recursive function to take the value 3 to the power of another number. For example,
if 4 is passed, the function will return 81.
2. This program is designed to handle data such at rollno, name and marks of a student. In this
program, the following operations are performed:
Information on a new student is entered and stored in the student.txt file.
The student.txt file is printed on screen on the operator's request.
The student.txt file is sorted on the basis of marks and stored in the file
marks.txt.
Information on a student whose rollno is given is printed on screen.
The average marks of all students are calculated.
3. Write a program that prompts for the user's last name, first name, and middle name
individually. Then store the name in a new string as first initial, period, space, middle initial,
period, space, last name. For example, if Bradley, Lee, and Jones are entered, store B. L.
Jones. Display the new name to the screen.
4. Write a program that opens an existing text file and copies it to a new text file with all
lowercase letters changed to uppercase, and all other characters unchanged.
5. Write a function that (a) is passed a variable number of strings as arguments, (b)
concatenates the strings, in order, into one longer string, and (c) returns a pointer to the
new string to the calling program.
6. Write a structure that is to be used in a single-linked list. This structure should hold your
friends' names and addresses.

Вам также может понравиться