0% found this document useful (0 votes)
22 views11 pages

Quize_round1

The document consists of a series of multiple-choice questions related to the C programming language, covering syntax, variable declaration, control structures, and memory management. It includes questions about operators, functions, loops, and data types, along with their correct answers. The document serves as a quiz or study guide for individuals learning C programming.

Uploaded by

Sushma Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views11 pages

Quize_round1

The document consists of a series of multiple-choice questions related to the C programming language, covering syntax, variable declaration, control structures, and memory management. It includes questions about operators, functions, loops, and data types, along with their correct answers. The document serves as a quiz or study guide for individuals learning C programming.

Uploaded by

Sushma Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

1. What is a correct syntax to output "Hello World" in C?

a) printf("Hello World");
b) cout << "Hello World";
c) Console.WriteLine("Hello World");
d) System.out.printline("Hello World");

2. How do you insert COMMENTS in C code?

a) # This is a comment
b) $ This is a comment
c) /* This is a comment
d) // This is a comment

3. When a variable is created in C, a memory address is assigned to the variable.

a) False
b) True

4. In C, code statements must end with a semicolon (;)

a) False
b) True

5. How can you create a variable with the numeric value 5?

a) num = 5 int;
b) int num = 5;
c) val num = 5;
d) num = 5;

6. How can you create a variable with the floating number 2.8?

a) num = 2.8 float;


b) float num = 2.8;
c) val num = 2.8;
d) num = 2.8 double;

7. Which operator is used to add together two values?

a) The * sign
b) The ADD keyword
c) The + sign
d) The & sign

8. Which function is often used to output values and print text?

a) write()
b) printf()
c) printword()
d) output()

9. Which format specifier is often used to print integers?

a) %c
b) %d
c) %f
d) %s

10. Which operator can be used to compare two values?

a) <>
b) =
c) ==
d) ><
11. Which operator can be used to find the memory size (in bytes) of a data type or

variable?

a) The len property


b) The sizeof property
c) The length property
d) The sizer property

12. Which keyword can be used to make a variable unchangeable/read-only?

a) const
b) final
c) constant
d) readonly

13. What do we call the following? int myNumbers[] = {25, 50, 75, 100};

a) An array
b) A class
c) None of the above
d) A pointer

14. Array indexes start with:

a) 0
b) 1

15. How do you call a function in C?


a) myFunction;
b) (myFunction);
c) myFunction[];
d) myFunction();

How do you start writing an if statement in C?

a) if x > y then
b) if x > y
c) if (x > y)
d) if x > y()

16. How do you start writing a while loop in C?

a) while x < y then


b) if x > y while
c) while (x < y)
d) while x < y

17. Which keyword is used to return a value inside a function?

a) get
b) break
c) void
d) return

18. How do you start writing a for loop in C?

a) for (x in y)
b) for (i = 0; i < 5; i++)
c) for (i = 0; while < 5; i++)
d) for (i = 0; switch < 5; i++)
19. Which statement can be used to select one of many code blocks to be executed?

a) switch
b) default
c) when
d) break

20. Which statement is used to stop a loop?

a) stop
b) break
c) exit
d) void

21. Which keyword is used to create a class in C?

a) class
b) None of the above
c) class()
d) class = myClass

22. What is ptr in the following code known as? int* ptr = &myAge;

a) A class
b) A pointer
c) A parameter
d) An array

23. In C, it is possible to inherit class properties and functions from one class to

another.
a) True
b) False

24. Which keyword is used to create a structure?

a) struct
b) structs
c) str
d) structure

25. In the C program, '&' is used in 'scanf' to indicate


a) AND operation
b) Memory location
c) Value of the variable
d) Value at the memory location.

answer b

26. The control/conditional statements used in C is/are


a) if-else statements
b) switch statements
c) Both (a) and (b)
d) None of these

answer c

a) The loop which is executed at least one is


a) while
b) do-while
c) for
d) none of the above

answer b

a) What will be the output?

#include <stdio.h>
int main()

if((0 && 1)||(1 && -1))

printf("Condition is true.");

else

printf("Condition is false.");

return 0;

a) Condition is true
b) Condition is false
c) Compilation Error
d) No output possible

answer a

a) What will be the output?

#include <stdio.h>

int main()

switch(printf("Techmiti"))

default:

printf("FIRE");

case 1: printf("Intresting");

break;

case 2: printf("Fun");

break;

case 3: printf(" Exciting ");

break;

return 0;

}
a) Techmiti FIRE Intresting
b) Techmiti Intresting
c) Techmiti Fun
d) Techmiti FIRE
a) e> Techmiti Exciting

answer a.

b) What will be the output?

#include <stdio.h>

int main()

int x;

x = 4 > 8 ?5 != 1 < 5 == 0 ? 1: 2: 3;

printf("%d", x);

return 0;

a) 1
b) 2
c) 3
d) Error

``answer c

27. An integer array (An integer takes two bytes of memory) of size 15 is declared in a C
program. The memory location of the first byte of the array is 2000. What will be the
location of the 13th element of the array?
a) 2013
b) 2024
c) 2026
d) 2030

answer b
28. What is the output of the program?

#include<stdio.h>

void swap(char *str1, char *str2)

char *temp = str1;

str1 = str2;

str2 = temp;

int main()

char *str1 = "Techmiti";

char *str2 = "2022";

swap(str1, str2);

printf("str1 is %s, str2 is %s", str1, str2);

return 0;

a) str1 is Techmiti, str2 is 2022


b) str1 is 2022, str2 is Techmiti
c) str1 is Swayam, str2 is Techmiti
d) str1 is 2022, str2 is 2022

answer a.

29. What is the output of the program?


#include<stdio.h>
int main(int argc, char *argv[])
{
int x = 1, z[2] = {10, 11};
int *p = NULL;
p = &x;
*p = 10;
p = &z[1];
*(&z[0] + 1) += 3;
printf("%d, %d, %dn", x, z[0], z[1]);
return 0;
}
a. 1, 10, 11
b. 1, 10, 14
c. 10, 14, 11
d. 10, 10, 14
Answer d.
30.

Choose correct option.

int f(int x, int *py, int **ppz)

int y, z;

**ppz += 1;

z = **ppz;

*py += 2;

y = *py;

x += 3;

return x + y + z;

int main()

int c, *b, **a;

c = 4;

b = &c;

a = &b;

printf("%d ", f(c, b, a));

return 0;

a) 18
b) 19
c) 21
d) 22

Answer b.

You might also like