Deck 3: Loops, Headers, Macros, and Arrays
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/53
العب
ملء الشاشة (f)
Deck 3: Loops, Headers, Macros, and Arrays
1
What is output of below program?
Int main()
{
Int i,j;
For(i = 0,j=0;i<5;i++)
{
Printf("%d%d--",i,j);
}
Return 0;
}
A)0--01--12--23--34--
B)00--10--20--30--40--
C)Compilation Error
D)00--01--02--03--04--
Int main()
{
Int i,j;
For(i = 0,j=0;i<5;i++)
{
Printf("%d%d--",i,j);
}
Return 0;
}
A)0--01--12--23--34--
B)00--10--20--30--40--
C)Compilation Error
D)00--01--02--03--04--
00--10--20--30--40--
2
What is output of below program?
Int main()
{
Int i;
For(i=0; i<5; ++i++)
{
Printf("Hello");
}
Return 0;
}
A)Hello is printed 5 times
B)Compilation Error
C)Hello is printed 2 times
D)Hello is printed 3 times
Int main()
{
Int i;
For(i=0; i<5; ++i++)
{
Printf("Hello");
}
Return 0;
}
A)Hello is printed 5 times
B)Compilation Error
C)Hello is printed 2 times
D)Hello is printed 3 times
Compilation Error
3
What is output of below program?
Int main()
{
For(; ;);
For(; ;);
Printf("Hello");
Return 0;
}
A)Compilation Error
B)Runtime Error
C)Nothing is printed
D)Hello is printed infinite times
Int main()
{
For(; ;);
For(; ;);
Printf("Hello");
Return 0;
}
A)Compilation Error
B)Runtime Error
C)Nothing is printed
D)Hello is printed infinite times
Nothing is printed
4
What is the output of below program?
Int main()
{
For(; ;)
For(; ;)
Printf("Hello..");
Return 0;
}
A)Compilation Error
B)Runtime Error
C)Hello is printed one time
D)Hello is printed infinite times
Int main()
{
For(; ;)
For(; ;)
Printf("Hello..");
Return 0;
}
A)Compilation Error
B)Runtime Error
C)Hello is printed one time
D)Hello is printed infinite times
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
5
How many loops are there in C
A)1
B)2
C)3
D)4
A)1
B)2
C)3
D)4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
6
What is the following is invalid header file in C?
A)math.h
B)mathio.h
C)string.h
D)ctype.h
A)math.h
B)mathio.h
C)string.h
D)ctype.h
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
7
What is storage class for variable A in below code?int main(){int A;A = 10;printf("%d", A);return 0;}
A)extern
B)auto
C)register
D)static
A)extern
B)auto
C)register
D)static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
8
#include "stdio.h"
Int main()
{
Int a@ = 10;
Printf("%d", a@);
Return 0;
}
A)10
B)10@
C)@
D)[Error] stray '@' in program
Int main()
{
Int a@ = 10;
Printf("%d", a@);
Return 0;
}
A)10
B)10@
C)@
D)[Error] stray '@' in program
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
9
#include "stdio.h"
Int main()
{
Int a = 10;
Printf("%d", a);
Int a = 20;
Printf("%d",a);
Return 0;
}
A)1020
B)Error: Redeclartion of a
C)2020
D)1010
Int main()
{
Int a = 10;
Printf("%d", a);
Int a = 20;
Printf("%d",a);
Return 0;
}
A)1020
B)Error: Redeclartion of a
C)2020
D)1010
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
10
#include "stdio.h"int a = 20;
Int main()
{
Int a = 10;
Printf("%d", ::a);
Return 0;
}
A)10
B)20
C)::20
D)::10
Int main()
{
Int a = 10;
Printf("%d", ::a);
Return 0;
}
A)10
B)20
C)::20
D)::10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
11
#include "stdio.h"
Int main()
{
Int a = 10, b = 20;
If(a=b)
{
Printf("Easy");
}
Else{printf("Hard");
}
Return 0;
}
A)Easy
B)Hard
C)EasyHard
D)Error in program
Int main()
{
Int a = 10, b = 20;
If(a=b)
{
Printf("Easy");
}
Else{printf("Hard");
}
Return 0;
}
A)Easy
B)Hard
C)EasyHard
D)Error in program
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which gcc flag is used to enable all Compiler warnings?
A)gcc -W
B)gcc -w
C)gcc -Wall
D)gcc -wall
A)gcc -W
B)gcc -w
C)gcc -Wall
D)gcc -wall
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
13
Which gcc flag is used to generate maximum debug information?
A)gcc -g0
B)gcc -g1
C)gcc -g
D)gcc -g3
A)gcc -g0
B)gcc -g1
C)gcc -g
D)gcc -g3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
14
Which macro is used to insert assembly code in C program (VC++ compiler)?
A)__asm__
B)_asm_
C)__asm
D)asm
A)__asm__
B)_asm_
C)__asm
D)asm
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which macro is used to insert assembly code in C program (GCC compiler)?
A)__asm__
B)_asm_
C)__asm
D)asm
A)__asm__
B)_asm_
C)__asm
D)asm
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
16
Will compiler produce any compilation error if same header file is included two times?
A)YES
B)NO
A)YES
B)NO
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
17
What should be the output of below program? #define
# @@include "stdio.h"
Int main()
{
Printf("C.com");
Return 0;
}
A)C.com
B)Nothing
C)Compilation Error
D)Depends on Complier
# @@include "stdio.h"
Int main()
{
Printf("C.com");
Return 0;
}
A)C.com
B)Nothing
C)Compilation Error
D)Depends on Complier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which one of the following is invalid macro in C programming?
A)#pragma
B)#error
C)#ifndef
D)#elseif
A)#pragma
B)#error
C)#ifndef
D)#elseif
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
19
What is the extension of output file produced by Preprocessor?
A).h
B).exe
C).i
D).asm
A).h
B).exe
C).i
D).asm
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
20
Set of consecutive memory locations is called as ________.
A)Function
B)Array
C)Loop
D)Pointer
A)Function
B)Array
C)Loop
D)Pointer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
21
Array can be considered as set of elements stored in consecutive memory locations but having __________.
A)Same Data Type
B)Same Scope
C)None of these
D)Different Data Type
A)Same Data Type
B)Same Scope
C)None of these
D)Different Data Type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
22
In Array, There is one to one correspondence between set of ________ and set of values.
A)Indices
B)Variables
C)Constants
D)Memory Locations
A)Indices
B)Variables
C)Constants
D)Memory Locations
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
23
Smallest element of an array is called as _______.
A)Middle Bound
B)Range
C)Upper Bound
D)Lower Bound
A)Middle Bound
B)Range
C)Upper Bound
D)Lower Bound
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
24
If we have declared an array described below -int arr[6];then which of the following array element is considered as last array element ?
A)arr[6]
B)arr[4]
C)arr[0]
D)arr[5]
A)arr[6]
B)arr[4]
C)arr[0]
D)arr[5]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
25
Array which is having ____ dimensions is called as 2-D array.
A)3
B)2
C)5
D)4
A)3
B)2
C)5
D)4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is maximum dimension that array can have in c programming?
A)2
B)4
C)Theoretically No Limit but practically limit depends on memory
D)3
A)2
B)4
C)Theoretically No Limit but practically limit depends on memory
D)3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
27
Array with last element 'n' will always have array size equal to _______.
A)n+1
B)n-1
C)n+n
D)n
A)n+1
B)n-1
C)n+n
D)n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
28
Array is an example of _______ type memory allocation.
A)Compile Time
B)Run Time
C)none
D)all
A)Compile Time
B)Run Time
C)none
D)all
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
29
Array is ______ data type in C Programming language.
A)Custom Data Type
B)Primitive Data Type
C)None of these
D)Derived Data Type
A)Custom Data Type
B)Primitive Data Type
C)None of these
D)Derived Data Type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
30
A Pointer to a block of memory is considered same as an array.
A)NO
B)YES
C)none
D)all
A)NO
B)YES
C)none
D)all
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
31
What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
A)The element will be set to 0.
B)The compiler would report an error.
C)The array size would appropriately grow.
D)The program may crash if some important data gets overwritten.
A)The element will be set to 0.
B)The compiler would report an error.
C)The array size would appropriately grow.
D)The program may crash if some important data gets overwritten.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
32
If you pass an array as an argument to a function, what actually gets passed?
A)Base address of the array
B)Value of elements in array
C)First element of the array
D)Address of the last element of array
A)Base address of the array
B)Value of elements in array
C)First element of the array
D)Address of the last element of array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
33
Pointer is special kind of variable which is used to store __________ of the variable.
A)Address
B)Value
C)Variable Name
D)Data Type
A)Address
B)Value
C)Variable Name
D)Data Type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
34
Pointer variable is declared using preceding _________ sign.
A)^
B)*
C)&
D)%
A)^
B)*
C)&
D)%
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
35
Address stored in the pointer variable is of type __________.
A)Integer
B)Array
C)Floating
D)Character
A)Integer
B)Array
C)Floating
D)Character
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
36
Consider the 32 bit compiler. We need to store address of integer variable to integer pointer. What will be the size of integer pointer?
A)10 Bytes
B)4 Bytes
C)2 Bytes
D)6 Bytes
A)10 Bytes
B)4 Bytes
C)2 Bytes
D)6 Bytes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
37
In order to fetch the address of the variable we write preceding _________ sign before variable name.
A)Asteriks
B)Percent
C)Comma
D)Ampersand
A)Asteriks
B)Percent
C)Comma
D)Ampersand
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
38
What is true about fputs function
A)write to a file
B)takes two parameters
C)requires a file pointer
D)all of above
A)write to a file
B)takes two parameters
C)requires a file pointer
D)all of above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
39
Wild pointer in C
A)if pointer is pointing to a memory location from where variable has been deleted
B)if pointer has not been initialized
C)if pointer has not defined properly
D)if pointer pointing to more than one variable
A)if pointer is pointing to a memory location from where variable has been deleted
B)if pointer has not been initialized
C)if pointer has not defined properly
D)if pointer pointing to more than one variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
40
Any type of modification on the parameter inside the function will reflect in actual variable value can be related to..
A)call by value
B)call by reference
C)both of above
D)none of above
A)call by value
B)call by reference
C)both of above
D)none of above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
41
Size of void pointer is
A)1 byte
B)2 byte
C)3 byte
D)4 byte
A)1 byte
B)2 byte
C)3 byte
D)4 byte
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
42
To print a single character in ouptut,which function is used?
A)getchar()
B)gets()
C)putchar()
D)puts()
A)getchar()
B)gets()
C)putchar()
D)puts()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
43
#define t 10
Void main()
{
Printf("%d",t);
}
A)10
B)Error:Unfined symbol 't'
C)Error:Improper placement of preprocessor
D)none of the above
Void main()
{
Printf("%d",t);
}
A)10
B)Error:Unfined symbol 't'
C)Error:Improper placement of preprocessor
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
44
Explicit data type conversion is called
A)Type casting
B)conversion
C)separation
D)none
A)Type casting
B)conversion
C)separation
D)none
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
45
which of these is not a valid character constant
A)"A"
B)'A'
C)"*"
D)"+"
A)"A"
B)'A'
C)"*"
D)"+"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
46
If 'a' is the integer which is not statically initialized then what is the value of 'a'?
A)zero
B)garbage
C)none of these
D)One
A)zero
B)garbage
C)none of these
D)One
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
47
C is a ____________________ language
A)Platform independent programming
B)Platform dependent programming
C)Object oriented programming
D)None of the above.
A)Platform independent programming
B)Platform dependent programming
C)Object oriented programming
D)None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
48
In a function call, _____________ is passed as arguments.
A)variables
B)constants
C)Expressions
D)All the above
A)variables
B)constants
C)Expressions
D)All the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
49
() is used for _________
A)function body
B)Arguments
C)Return type
D)Declaration of function
A)function body
B)Arguments
C)Return type
D)Declaration of function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
50
which is better memory allocation when size is not known
A)static
B)dynamic
C)both
D)neither
A)static
B)dynamic
C)both
D)neither
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
51
which of the following is the best for getting a string with space from the standard input
A)gets
B)getc
C)fgets
D)puts
A)gets
B)getc
C)fgets
D)puts
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
52
Which statement is used to compare the two strings?
A)strcmp
B)strcompare
C)stringcompare
D)str_cmp
A)strcmp
B)strcompare
C)stringcompare
D)str_cmp
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
53
void main() {
Printf();
}
A)Run-Time Error
B)Compile-Time Error
C)none
D)all
Printf();
}
A)Run-Time Error
B)Compile-Time Error
C)none
D)all
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck