M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE July, 2014 Solved
1. Multiple Choice
1.1 : B
Explanation : void is used to indicate that a function will not be return
any data to calling function. You should also use void in place of argument for
when function does not takes argument but it’s optional.
If you left blank of return type then int will be consider as
default return type of given function.
1.2 : C
1.3 : B
Explanation : Name of an array is constant pointer which point first
element when 5 added to pointer then it jump 5 places to forward direction.
1.4 : A
Explanation : You cannot define a function within another function in standard C.You can declare a function inside of a function, but it's not a nested function.
1.5 : D
1.6 : A
1.7 : B
1.8 : D
Explanation : You can leave row while an array is initialized at
declaration time. Compiler assigned row after counting {{},{},{}}. Inner {} indicate row.
1.9 : B
Explanation : scanf truncate character after space while taking input because when space press scan stop input immediately and place character before space in relevant variable.
1.10 : C
2.1 : T1.9 : B
Explanation : scanf truncate character after space while taking input because when space press scan stop input immediately and place character before space in relevant variable.
1.10 : C
Explanation : Static data type in c language initialize by 0 and only one
time. It also retains a variable data till the program is running.
2. True/False
2.2 : F
Explanation : /* */ is used to make comment
2.3 : T
Explanation :
mode
|
Description
|
"r"
|
Opens a file for reading. The file must exist.
|
"w"
|
Creates an empty file for writing. If a file with the same
name already exists, its content is erased and the file is considered as a
new empty file.
|
"a"
|
Appends to a file. Writing operations, append data at the end
of the file. The file is created if it does not exist.
|
"r+"
|
Opens a file to update both reading and writing. The file must
exist.
|
"w+"
|
Creates an empty file for both reading and writing.
|
"a+"
|
Opens a file for reading and appending.
|
2.4 : F
2.5 : T
2.6 : F
2.7 : T
2.8 : T
2.9 : F
Explanation : Sizeof is an unary operator sizeof generates the size of a variable or datatype, measured in the number of char size storage units required for the type. As such, the construct sizeof (char) is guaranteed to be 1.
2.10 : T
Back to question Paper2.7 : T
2.8 : T
2.9 : F
Explanation : Sizeof is an unary operator sizeof generates the size of a variable or datatype, measured in the number of char size storage units required for the type. As such, the construct sizeof (char) is guaranteed to be 1.
2.10 : T
3. Match The Column
3.1 : F
3.2 : G
3.3 : J
3.4: A
3.5 : B
3.6 : K
3.7 : E
3.8 : C
3.9 : I
3.10 : D
4. Fill in the Blank
4.1 : D
4.2 : F
4.3 : E
4.4 : G
4.5 : A
4.6 : C
4.7 : J
4.8 : H
4.9 : M
4.10 : L
Thanks for answer.
ReplyDelete2.8 I think the names of parameters in function definition and declaration must be same is false
ReplyDelete