Programming 1

Is this your test? Login to manage it. If not, you can make an exam just like it.

This is a non-interactive preview of the quiz content.

1.
1 point
What is the output of this C code?

#include

void main()

{

int y = 3;

int x = 5 % 2 * 3 / 2;

printf("Value of x is %d", x);

}
2.
1 point
Which of the following declaration is illegal?
3.
1 point
Is there any difference between following declarations?
1 : extern int fun();
2 : int fun();
4.
1 point
Which of the following is not a valid variable name declaration?


5.
1 point
What is the output of this C code?

#include

void main()

{

int b = 5 - 4 + 2 * 5;

printf("%d", b);

}
6.
1 point
The name of the variable used in one function cannot be used in another function



7.
1 point
What will be output if you will compile and execute the following c code?


#include
int main(){
char *str;
scanf("%[^\n]",str);
printf("%s",str);
return 0;
}
8.
1 point
Which of the following is not a valid variable name declaration?



9.
1 point
Which is NOT a statement?






10.
1 point
What is the output of this C code?

#include

void main()

{

int x = 5.3 % 2;

printf("Value of x is %d", x);

}
11.
1 point
Operation “a = a * b + a” can also be written as:



12.
1 point
Which of the following is not user defined data type?
1 :

struct book
{
char name[10];
float price;
int pages;
};

2 :

long int l = 2.35;

3 :

enum day {Sun, Mon, Tue, Wed};
13.
1 point
What punctuation is used to signal the beginning and end of code blocks?




14.
1 point
By default a real number is treated as a
15.
1 point
Which of the following operators represent the logical AND?
16.
1 point
What punctuation ends most lines of C code?
17.
1 point
Which of the following is the correct operator to compare two variables?


18.
1 point
Which of the following is not a valid C variable name?



19.
1 point
What is the output of the code given below?

#include

int main()

{

int ary[4] = {1, 2, 3, 4};

int *p = ary + 3;

printf("%d\n", p[-2]);

}
20.
1 point
Which of the following is used to compare the variables?
21.
1 point
What is the only function all C programs must contain?
22.
1 point
Which of the following cannot be checked in switch case statement?






23.
1 point
Which of the following shows the correct syntax for an if statement?



24.
1 point
Which of the following special symbol allowed in a variable name?
25.
1 point
A variable declared in a function can be used in main