Beat the Q final
Beat the Q: C Programming Challenge
Test your knowledge of C programming with our comprehensive quiz designed for both beginners and experts. Challenge your understanding of key concepts, syntax, and logic in C programming.
What to expect:
- 41 engaging questions
- Diverse topics including pointers, arrays, and error handling
- Instant feedback on your answers
The parameter passing mechanism for an array is
Call by value
Call by value-result
Call by reference
None of these
output??
int main()
{ extern int I;
i = 20;
printf("%d", sizeof(i));
return 0;
}
Undefined reference to I
Linking Error
20
0
The operators > and < are meaningful when used with pointers, if
The pointers point to data of similar type
The pointers point to structure of similar data type
The pointers point to elements of the same array
None of these
For 'C' programming language
Constant expressions are evaluated at compile
String constants can be concatenated at compile time
Size of array should be known at compile time
All of these
output??
main()
{
int x = 10;
{
int x = 0;
printf("%d",x);
}
}
Compilation Error
0
Undefined
10
Is it true that a function may have several declaration, but only one definition.
True
False
A pointer variable can be
Passed to a function as argument
Changed within a function
Returned by a function
Can be assigned an integer value
Size of the array need not be specified, when
Initialization is a part of definition
It is a declaratrion
It is a formal parameter
All of these
If storage class is missing in the array definition, by default it will be taken to be
automatic
Either automatic or external depending on the place of occurrence
External
Static
Output???
void main()
{
int a = printf ("CppBuzz.com");
printf("%d", a);
}
Compilation Error
CppBuzz.com11
CppBuzz.com
0
While passing an array as an actual argument, the function call must have the array name
With empty brackets
With its size
Alone
None of the above
What will be the output??
int main()
{
int _ = 10;
int __ = 20;
int ___ = _ + __;
printf("__%d",___);
return 0;
}
Compilation Error
Runtime Error
__0
__30
If a two dimensional array is used as a formal parameter, then
Both the subscripts may be left empty
The first (row) subscript may be left empty
The first subscript must be left empty
Both the subscripts must be left empty
If n has the value 3, then the statement a [++n] = n++ ;
Assigns 3 to a [5]
Assigns 4 to a [5]
Assigns 4 to a [4]
What is assigned is compiler-dependent
Output??
int main()
{
int a = 5;
int b = 10;
int c = a+b;
printf("%i",c);
}
0
15
Undefined I
Any other Compiler Error
Choose the correct statements
Strictly speaking C supports 1-dimensional arrays only
An array element may be an array by itself
Array elements need not occupy contiguous memory locations
Both (a) and (b)
Representation of data structure in memory is known as:
Recursive
Storage structure
Abstract data type
File structure
Select the correct value of I from given options
i=scanf("%d %d", &a, &b);
1
2
3
No value assigned
A________search begins the search with the element that is located in the middle of the array.
Serial
Random
Parallel
Binary Search
Output??
int main()
{
int x;
x=10,20,30;
printf("%d",x);
return 0;
}
Compilation Error
10
20
30
Most appropriate sentence to describe unions is
Union are like structures
Union contain members of different data types which share the same storage area in memory
Union are less frequently used in program
Union are used for set operations
How many times CppBuzz.com is printed?
void main()
{
int a = 0;
while(a++ < 5-++a)
printf("CppBuzz.com");
}
5 times
4 times
2 times
1 times
It is necessary to declare the type of a function in the calling program if the function
Returns an integer
Returns a non-integer value
Is not defined in the same file
None of these
What error would the following function give on compilation ?
f(int a,int b)
{
int a;
a = 20;
return a;
}
Missing parentheses in return statement
Function should be define as int f(int a,int b)
Redeclaration of a
No error
What error is generated on placing an address operator with a variable in the printf statement?
Compile error
Run-time error
Logical error
No error
A function that is prototyped as double calculate (int, num); may
Receive an integer constant such as 12
Receive an integer variable
Either (a) or (b)
None of these
How many times CppBuzz.com is printed?
void main()
{
int a = 0;
while(a++);
{
printf("CppBuzz.com");
}
}
0 time
1 time
Compilation Error
Infinite times
For loop in a C program, if the condition is missing
It is assumed to be present and taken to be false
It result in a syntax error
It is assumed to be present and taken to the true
Execution will be terminated abruptly
How many times will the following loop be executed if the input data item is 0 1 2 3 4 ? while (c = getchar ()! = 0)
Infinitely
Never
Once
None of these
A "switch" statement is used to
Switch between functions in a program
Switch from one variable to another variable
To choose from multiple possibilities which may arise due to different values of a single variable
All of above
Which of the following function compares 2 strings with case-insensitively?
Strcmp(s, t)
Strcmpcase(s, t)
Strcasecmp(s, t)
Strchr(s, t)
The function fopen("filename","r")returns
Nothing
A value 0 or 1 depending on whether the file could be opened or not.
A pointer to a new file after creating it.
A pointer to FILE filename,if it exits
What will be the output of the following C code?
char str[] =”Too Good”;
printf(“\n %7s”,str);
Too Good
Too G
Too Go
Too
The statement
if ( myPtr != NULL )
*myPtr = NULL;
else
*myPtr = NULL;
has the same effect as the statements(s)
if(myPtr)
*myPtr = NULL;
else
*myPtr = NULL;
*myPtr = NULL;
if(!myPtr)
*myPtr = NULL;
else
*myPtr = NULL;
All of these
What is output of below program?
void main()
{
for(; ;);
for(; ;);
printf("Hello"); }
Compilation Error
Runtime Error
Nothing is printed
Hello is printed infinite times
Consider the two declarations
void *voidPtr;
char *charPtr;
Which of the following assignments are syntactically correct?
VoidPtr = charPtr
CharPtr = voidPer
*voidPtr = *charPtr
*charPtr = voidPtr
An algorithm is made up of 2 modules M1&M2. If order of M1 is f(n) & M2 is g(n), then the order of algorithm is?
Max (f(n),g(n))
Min (f(n),g(n))
F(n) + g(n)
F(n) * g(n)
What will be the output of the following C code?
int main()
{
char *str = "hello, world";
char *str1 = "hello, world";
if (strcmp(str, str1))
printf("equal");
else
printf("unequal"); }
Equal
Unequal
Compilation error
Depends on the compiler
An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons needed?
At least 2n-c comparisons, for some constant c, are needed.
At least nlog2n comparisons are needed.
At most 1.5n-2 comparisons are needed.
None of the above.
Unrestricted use of goto is harmful, because it
Makes debugging difficult
Increases the running time of programs
Increases memory requirement of programs
results in the compiler generating longer machine code
{"name":"Beat the Q final", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of C programming with our comprehensive quiz designed for both beginners and experts. Challenge your understanding of key concepts, syntax, and logic in C programming.What to expect:41 engaging questionsDiverse topics including pointers, arrays, and error handlingInstant feedback on your answers","img":"https:/images/course3.png"}
More Quizzes
COMP 1 Last Section of Exam Review
11634
C - Program Quiz | HOWZIT AI Messenger | Indian Aibot App
HOWZIT will present prizes to the winners
740
C
1050
Data Structure
10522
Object Oriented Programming
7425
C++ Programming
10516
CIS 1101 Prefinal - Pointers (PART 1)
22110
C
1050
STUCTURED PROGRAMMING CAT
9424
CSCI 201L MT Quizzes
371833
Algoritmiz
1065395
Programming for Games I - Quizzes 10-18 Combined for Final Exam Review
1075469