Deck 1: Introduction to C Language

ملء الشاشة (f)
exit full mode
سؤال
Which of the following is not a valid variable name declaration?

A)int __a3;
B)int __3a;
C)int __A3;
D)None of the mentioned
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which of the following is not a valid variable name declaration?

A)int _a3;
B)int a_3;
C)int 3_a;
D)int _3a
سؤال
Why do variable names beginning with the underscore is not encouraged?

A)It is not standardized
B)To avoid conflicts since assemblers and loaders use such names
C)To avoid conflicts since library routines use such names
D)To avoid conflicts with environment variables of an operating system
سؤال
All keywords in C are in ____________

A)LowerCase letters
B)UpperCase letters
C)CamelCase letters
D)None of the mentioned
سؤال
Variable name resolution (number of significant characters for the uniqueness of variable) depends on ___________

A)Compiler and linker implementations
B)Assemblers and loaders implementations
C)C language
D)None of the mentioned
سؤال
Which of the following is not a valid C variable name?

A)int number;
B)float rate;
C)int variable_count;
D)int $main;
سؤال
Which of the following is true for variable names in C?

A)They can contain alphanumeric characters as well as special characters
B)It is not an error to declare a variable to be one of the keywords(like goto, static)
C)Variable names cannot start with a digit
D)Variable can be of any length
سؤال
What is short int in C programming?

A)The basic data type of C
B)Qualifier
C)Short is the qualifier and int is the basic data type
D)All of the mentioned
سؤال
The format identifier '%i' is also used for _____ data type.

A)char
B)int
C)float
D)double
سؤال
Which data type is most suitable for storing a number 65000 in a 32-bit system?

A)signed short
B)unsigned short
C)long
D)int
سؤال
Which of the following is a User-defined data type?

A)typedef int Boolean;
B)typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
C)struct {char name[10], int age};
D)all of the mentioned
سؤال
What is the size of an int data type?

A)4 Bytes
B)8 Bytes
C)Depends on the system/compiler
D)Cannot be determined
سؤال
enum types are processed by _________

A)Compiler
B)Preprocessor
C)Linker
D)Assembler
سؤال
Which of the following statement is false?

A)Constant variables need not be defined as they are declared and can be defined later
B)Global constant variables are initialized to zero
C)const keyword is used to define constant values
D)You cannot reassign a value to a constant variable
سؤال
Which of the following declaration is not supported by C?

A)String str;
B)char *str;
C)float str = 3e2;
D)Both String str; & float str = 3e2;
سؤال
Which of the following declaration is illegal?

A)char *str = "string Contents";
B)char str[] = "string Contents"";
C)char str[20] = "string Contents"";
D)char[] str = "string Contents"";
سؤال
Which keyword is used to prevent any changes in the variable within a C program?

A)immutable
B)mutable
C)const
D)volatile
سؤال
Which of the following is not a pointer declaration?

A)char a[10];
B)char a[] = {'1', '2', '3', '4'};
C)char *str;
D)char a;
سؤال
Which of the following statement is false?

A)A variable defined once can be defined again with different scope
B)A single variable cannot be defined with two different types in the same scope
C)A variable must be declared and defined at the same time
D)A variable refers to a location in memory
سؤال
A variable declared in a function can be used in main().

A)True
B)False
C)True if it is declared static
D)None of the mentioned
سؤال
What is the precedence of arithmetic operators (from highest to lowest)?

A)%, *, /, +, -
B)%, +, /, *, -
C)+, -, %, *, /
D)%, +, -, *, /
سؤال
Which of the following is not an arithmetic operation?

A)a * = 10;
B)a / = 10;
C)a ! = 10;
D)a % = 10;
سؤال
Which of the following data type will throw an error on modulus operation(%)?

A)char
B)short
C)int
D)float
سؤال
Which among the following are the fundamental arithmetic operators, i.e, performing the desired operation can be done using that operator only?

A)+, -
B)+, -, %
C)+, -, *, /
D)+, -, *, /, %
سؤال
Are logical operator sequence points?

A)True
B)False
C)Depends on the compiler
D)Depends on the standard
سؤال
Do logical operators in the C language are evaluated with the short circuit?

A)True
B)False
C)Depends on the compiler
D)Depends on the standard
سؤال
What is the result of logical or relational expression in C?

A)True or False
B)0 or 1
C)0 if an expression is false and any positive number if an expression is true
D)None of the mentioned
سؤال
Relational operators cannot be used on ____________

A)structure
B)long
C)strings
D)float
سؤال
Which among the following is NOT a logical or relational operator?

A)!=
B)==
C)=
سؤال
What is the type of the following assignment expression if x is of type float and y is of type int? y = x + y;

A)int
B)float
C)there is no type for an assignment expression
D)double
سؤال
What will be the value of the following assignment expression? (x = foo())!= 1 considering foo() returns 2

A)2
B)True
C)1
D)0
سؤال
Operation "a = a * b + a" can also be written as ___________

A)a *= b + 1;
B)(c = a * b)!=(a = c + a);
C)a = (b + 1)* a;
D)All of the mentioned
سؤال
What will be the final value of c in the following C statement? (Initial value: c = 2) c <<= 1;

A)c = 1;
B)c = 2;
C)c = 3;
D)c = 4;
سؤال
In expression i = g() + f(), first function called depends on __________

A)Compiler
B)Associativiy of () operator
C)Precedence of () and + operator
D)Left to write of the expression
سؤال
Which operators of the following have same precedence? P. "!=", Q. "+=", R. "<<="

A)P and Q
B)Q and R
C)P and R
D)P, Q and R
سؤال
Comment on the following statement n = 1; printf("%d, %dn", 3*n, n++);

A)Output will be 3, 2
B)Output will be 3, 1
C)Output will be 6, 1
D)Output is compiler dependent
سؤال
Which is correct representation of C statement? e = a * b + c / d * f;

A)e = (a * (b +(c /(d * f))));
B)e = ((a * b) + (c / (d * f)));
C)e = ((a * b) + ((c / d)* f));
D)Both e = ((a * b) + (c / (d * f))); and e = ((a * b) + ((c / d)* f));
سؤال
While swapping 2 no' what at precautions to be taken care? b = (b / a); a = a * b; b = a / b;

A)Data type should be either of short, int and long
B)Data type should be either of float and double
C)All data types are accepted except for (char *)
D)This code doesn't swap 2 numbers
سؤال
function tolower(c) defined in library works for ___________

A)Ascii character set
B)Unicode character set
C)Ascii and utf-8 but not EBCDIC character set
D)Any character set
سؤال
Which type of conversion is NOT accepted?

A)From char to int
B)From float to char pointer
C)From negative int to char
D)From double to char
سؤال
Which of the following type-casting have chances for wrap around?

A)From int to float
B)From int to char
C)From char to short
D)From char to int
سؤال
Which of the following typecasting is accepted by C?

A)Widening conversions
B)Narrowing conversions
C)Widening & Narrowing conversions
D)None of the mentioned
سؤال
When do you need to use type-conversions?

A)The value to be stored is beyond the max limit
B)The value to be stored is in a form not supported by that data type
C)To reduce the memory in use, relevant to the value
D)All of the mentioned
سؤال
What is the scope of an external variable?

A)Whole source file in which it is defined
B)From the point of declaration to the end of the file in which it is defined
C)Any source file in a program
D)From the point of declaration to the end of the file being compiled
سؤال
What is the scope of a function?

A)Whole source file in which it is defined
B)From the point of declaration to the end of the file in which it is defined
C)Any source file in a program
D)From the point of declaration to the end of the file being compiled
سؤال
In the standard library of C programming language, which of the following header file is designed for basic mathematical operations?

A)math.h
B)conio.h
C)dos.h
D)stdio.h
سؤال
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?

A)rem = 3.14 % 2.1;
B)rem = modf(3.14, 2.1);
C)rem = fmod(3.14, 2.1);
D)Remainder cannot be obtain in floating point division.
سؤال
By default a real number is treated as a

A)float
B)double
C)long double
D) far double
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/48
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 1: Introduction to C Language
1
Which of the following is not a valid variable name declaration?

A)int __a3;
B)int __3a;
C)int __A3;
D)None of the mentioned
None of the mentioned
2
Which of the following is not a valid variable name declaration?

A)int _a3;
B)int a_3;
C)int 3_a;
D)int _3a
int 3_a;
3
Why do variable names beginning with the underscore is not encouraged?

A)It is not standardized
B)To avoid conflicts since assemblers and loaders use such names
C)To avoid conflicts since library routines use such names
D)To avoid conflicts with environment variables of an operating system
To avoid conflicts since library routines use such names
4
All keywords in C are in ____________

A)LowerCase letters
B)UpperCase letters
C)CamelCase letters
D)None of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
5
Variable name resolution (number of significant characters for the uniqueness of variable) depends on ___________

A)Compiler and linker implementations
B)Assemblers and loaders implementations
C)C language
D)None of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following is not a valid C variable name?

A)int number;
B)float rate;
C)int variable_count;
D)int $main;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following is true for variable names in C?

A)They can contain alphanumeric characters as well as special characters
B)It is not an error to declare a variable to be one of the keywords(like goto, static)
C)Variable names cannot start with a digit
D)Variable can be of any length
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
8
What is short int in C programming?

A)The basic data type of C
B)Qualifier
C)Short is the qualifier and int is the basic data type
D)All of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
9
The format identifier '%i' is also used for _____ data type.

A)char
B)int
C)float
D)double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which data type is most suitable for storing a number 65000 in a 32-bit system?

A)signed short
B)unsigned short
C)long
D)int
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
11
Which of the following is a User-defined data type?

A)typedef int Boolean;
B)typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
C)struct {char name[10], int age};
D)all of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
12
What is the size of an int data type?

A)4 Bytes
B)8 Bytes
C)Depends on the system/compiler
D)Cannot be determined
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
13
enum types are processed by _________

A)Compiler
B)Preprocessor
C)Linker
D)Assembler
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
14
Which of the following statement is false?

A)Constant variables need not be defined as they are declared and can be defined later
B)Global constant variables are initialized to zero
C)const keyword is used to define constant values
D)You cannot reassign a value to a constant variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following declaration is not supported by C?

A)String str;
B)char *str;
C)float str = 3e2;
D)Both String str; & float str = 3e2;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which of the following declaration is illegal?

A)char *str = "string Contents";
B)char str[] = "string Contents"";
C)char str[20] = "string Contents"";
D)char[] str = "string Contents"";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which keyword is used to prevent any changes in the variable within a C program?

A)immutable
B)mutable
C)const
D)volatile
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following is not a pointer declaration?

A)char a[10];
B)char a[] = {'1', '2', '3', '4'};
C)char *str;
D)char a;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following statement is false?

A)A variable defined once can be defined again with different scope
B)A single variable cannot be defined with two different types in the same scope
C)A variable must be declared and defined at the same time
D)A variable refers to a location in memory
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
20
A variable declared in a function can be used in main().

A)True
B)False
C)True if it is declared static
D)None of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
21
What is the precedence of arithmetic operators (from highest to lowest)?

A)%, *, /, +, -
B)%, +, /, *, -
C)+, -, %, *, /
D)%, +, -, *, /
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following is not an arithmetic operation?

A)a * = 10;
B)a / = 10;
C)a ! = 10;
D)a % = 10;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following data type will throw an error on modulus operation(%)?

A)char
B)short
C)int
D)float
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which among the following are the fundamental arithmetic operators, i.e, performing the desired operation can be done using that operator only?

A)+, -
B)+, -, %
C)+, -, *, /
D)+, -, *, /, %
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
25
Are logical operator sequence points?

A)True
B)False
C)Depends on the compiler
D)Depends on the standard
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
26
Do logical operators in the C language are evaluated with the short circuit?

A)True
B)False
C)Depends on the compiler
D)Depends on the standard
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
27
What is the result of logical or relational expression in C?

A)True or False
B)0 or 1
C)0 if an expression is false and any positive number if an expression is true
D)None of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
28
Relational operators cannot be used on ____________

A)structure
B)long
C)strings
D)float
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which among the following is NOT a logical or relational operator?

A)!=
B)==
C)=
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
30
What is the type of the following assignment expression if x is of type float and y is of type int? y = x + y;

A)int
B)float
C)there is no type for an assignment expression
D)double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
31
What will be the value of the following assignment expression? (x = foo())!= 1 considering foo() returns 2

A)2
B)True
C)1
D)0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
32
Operation "a = a * b + a" can also be written as ___________

A)a *= b + 1;
B)(c = a * b)!=(a = c + a);
C)a = (b + 1)* a;
D)All of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
33
What will be the final value of c in the following C statement? (Initial value: c = 2) c <<= 1;

A)c = 1;
B)c = 2;
C)c = 3;
D)c = 4;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
34
In expression i = g() + f(), first function called depends on __________

A)Compiler
B)Associativiy of () operator
C)Precedence of () and + operator
D)Left to write of the expression
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which operators of the following have same precedence? P. "!=", Q. "+=", R. "<<="

A)P and Q
B)Q and R
C)P and R
D)P, Q and R
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
36
Comment on the following statement n = 1; printf("%d, %dn", 3*n, n++);

A)Output will be 3, 2
B)Output will be 3, 1
C)Output will be 6, 1
D)Output is compiler dependent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which is correct representation of C statement? e = a * b + c / d * f;

A)e = (a * (b +(c /(d * f))));
B)e = ((a * b) + (c / (d * f)));
C)e = ((a * b) + ((c / d)* f));
D)Both e = ((a * b) + (c / (d * f))); and e = ((a * b) + ((c / d)* f));
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
38
While swapping 2 no' what at precautions to be taken care? b = (b / a); a = a * b; b = a / b;

A)Data type should be either of short, int and long
B)Data type should be either of float and double
C)All data types are accepted except for (char *)
D)This code doesn't swap 2 numbers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
39
function tolower(c) defined in library works for ___________

A)Ascii character set
B)Unicode character set
C)Ascii and utf-8 but not EBCDIC character set
D)Any character set
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which type of conversion is NOT accepted?

A)From char to int
B)From float to char pointer
C)From negative int to char
D)From double to char
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following type-casting have chances for wrap around?

A)From int to float
B)From int to char
C)From char to short
D)From char to int
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which of the following typecasting is accepted by C?

A)Widening conversions
B)Narrowing conversions
C)Widening & Narrowing conversions
D)None of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
43
When do you need to use type-conversions?

A)The value to be stored is beyond the max limit
B)The value to be stored is in a form not supported by that data type
C)To reduce the memory in use, relevant to the value
D)All of the mentioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
44
What is the scope of an external variable?

A)Whole source file in which it is defined
B)From the point of declaration to the end of the file in which it is defined
C)Any source file in a program
D)From the point of declaration to the end of the file being compiled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
45
What is the scope of a function?

A)Whole source file in which it is defined
B)From the point of declaration to the end of the file in which it is defined
C)Any source file in a program
D)From the point of declaration to the end of the file being compiled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
46
In the standard library of C programming language, which of the following header file is designed for basic mathematical operations?

A)math.h
B)conio.h
C)dos.h
D)stdio.h
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?

A)rem = 3.14 % 2.1;
B)rem = modf(3.14, 2.1);
C)rem = fmod(3.14, 2.1);
D)Remainder cannot be obtain in floating point division.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
48
By default a real number is treated as a

A)float
B)double
C)long double
D) far double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.