Programming in C

Descrição

First year First Year Quiz sobre Programming in C, criado por Faheem Ahmed em 26-03-2018.
Faheem Ahmed
Quiz por Faheem Ahmed, atualizado more than 1 year ago
Faheem Ahmed
Criado por Faheem Ahmed mais de 6 anos atrás
1678
0

Resumo de Recurso

Questão 1

Questão
A C variable name can start with a ____
Responda
  • Number
  • Plus Sign (+)
  • Underscore
  • Asterisk (*)

Questão 2

Questão
Name the loop that executes at least once.
Responda
  • for
  • if
  • do-while
  • while

Questão 3

Questão
A pointer pointing to a memory location of the variable even after deletion of the variable is known as _____
Responda
  • far pointer
  • dangling pointer
  • null pointer
  • void pointer

Questão 4

Questão
Which of the following correctly shows the hierarchy of arithmetic operations in C?
Responda
  • / + * -
  • * - / +
  • + - / *
  • / * + -

Questão 5

Questão
The output of the following code is: main() { int z, a = 5, b = 3; z = a * 2 + 26 % 3; printf("%d", z); }
Responda
  • 10
  • 0
  • 12
  • None of the above

Questão 6

Questão
The output of the following code is: void main() { char a = 'B'; switch (a) { case 'A' : printf("a"); case 'B' : printf("b"); default : printf("c"); } }
Responda
  • B
  • b
  • bca
  • bc

Questão 7

Questão
What is the output of this C code? main() { int x=35; printf("%d %d %d",x==35,x=50,x>40); }
Responda
  • 1 50 1
  • 0 50 0
  • Runtime error
  • Compile time error

Questão 8

Questão
Which among the following is NOT a logical or relational operator?
Responda
  • !=
  • ==
  • ||
  • =

Questão 9

Questão
Which of the following is not a correct variable type?
Responda
  • float
  • real
  • int
  • double

Questão 10

Questão
Which of the following is true?
Responda
  • 1
  • 66
  • 0.1
  • -1
  • All of the above

Questão 11

Questão
Evaluate !(1 && !(0 || 1)).
Responda
  • True
  • False
  • Unevaluatable
  • Error

Questão 12

Questão
Which of the following is the proper declaration of a pointer?
Responda
  • int x;
  • int &x;
  • ptr x;
  • int *x;

Questão 13

Questão
Which of the following gives the memory address of integer variable a?
Responda
  • *a;
  • a;
  • &a;
  • address(a);

Questão 14

Questão
Which of the following gives the value stored at the address pointed to by pointer a?
Responda
  • a;
  • val(a);
  • *a;
  • &a;

Questão 15

Questão
Which conversion is not possible?
Responda
  • int to float
  • float to int
  • char to float
  • All are possible

Questão 16

Questão
What variables stores the number of arguments to a program in command line arguments?
Responda
  • argc
  • argv
  • count
  • arglen

Questão 17

Questão
What is argv[0]?
Responda
  • The number of arguments to the program
  • The name of the program
  • The first argument to the program
  • This syntax is illegal

Questão 18

Questão
The parameter passing mechanism for an array is
Responda
  • call by value
  • call by value-result
  • call by reference
  • none of these

Questão 19

Questão
Consider the statement int val[2] [4] = { 1, 2, 3, 4, 5, 6, 7, 8} ; 4 will be the value of
Responda
  • val[0][ 3]
  • val[0][4]
  • val[1][1]
  • none of the above

Questão 20

Questão
The following program fragment int a = 4, b = 6; printf (" %d ", a == b);
Responda
  • outputs an error message
  • prints 0
  • prints 1
  • none of the above

Questão 21

Questão
The following program fragment int a = 4, b = 6; printf ("%d", a = b) ;
Responda
  • outputs an error message
  • prints 0
  • prints 1
  • 6

Questão 22

Questão
main( ) { int a = 5, b = 2; printf("%d", a+++b); }
Responda
  • results in syntax error
  • prints 7
  • prints 8
  • none of above

Questão 23

Questão
Let x be an integer which can take a value of 0 or 1. The statement if(x = =0) x = 1; else x = 0; is equivalent to which one of the following?
Responda
  • x=1+x;
  • x=1—x;
  • x=x—1;
  • x=1%x;

Questão 24

Questão
Which command is used to skip the rest of a loop and carry on from the top of the loop again?
Responda
  • break;
  • resume;
  • continue;
  • skip ;
  • exit;

Questão 25

Questão
Which of the following is not a storage class in C?
Responda
  • auto
  • struct
  • extern
  • static
  • register

Questão 26

Questão
Which of following is not a valid name for a C variable?
Responda
  • Hairaj
  • Hello_raj
  • Hello raj
  • Both (a) and (b) above
  • None of the above.

Questão 27

Questão
How many times the below loop will get executed? main() { int i; for(i=9;i;i=i-2) { printf("\n%d",i); } }
Responda
  • 5
  • 6
  • Compilation Error
  • Infinite

Questão 28

Questão
What will be the output main() { int i; i = 10; if(i == 20 || 30) {printf("True"); } else {printf("False"); } }
Responda
  • True
  • False
  • Syntax Error
  • Run time Error

Questão 29

Questão
What the below statement will print if a=10 and b = 20? printf("%d",a==b);
Responda
  • 20
  • 10
  • 1
  • 0

Questão 30

Questão
What is the output of the following code? void main(){ printf("%d%d%d",50,100); }
Responda
  • 50,100
  • 50,100,garbage
  • 50,100,0
  • 0,50,100

Questão 31

Questão
What is the output of the following program? void main(){ printf("%d%d",100,200,300); }
Responda
  • 100 200
  • 200 300
  • 300 200
  • 100 200 300

Questão 32

Questão
What is the output of the following program? void main(){ printf("2+3=%d",2+3); }
Responda
  • 2+3=0
  • 2+3=2+3
  • 2+3=5
  • 5=2+3

Questão 33

Questão
What is the output of the following program? void main(){ int a; a=3+5*5+3; printf("%d",a); }
Responda
  • 43
  • 64
  • 31
  • none of these

Questão 34

Questão
what is the output of following program? void main(){ int a; float f; a=12/5; f=12/5; printf("%d%f",a,f); }
Responda
  • 2,2.000000
  • 2,2.00
  • 2,2
  • none of these

Questão 35

Questão
What is the output of following program? void main(){ int a; a='a'>'A'; printf("%d",a); }
Responda
  • 0
  • 1
  • garbage
  • none of these

Questão 36

Questão
What is the output of following program? void abc(int a){ ++a; } void main(){ int a=10; abc(); abc(); printf("%d",a); }
Responda
  • 10
  • 11
  • 12
  • 13

Questão 37

Questão
What is the output of following program? void main(){ int i=10; printf("%d%d%d",++i, i++, ++i); }
Responda
  • 11 11 13
  • 13 11 11
  • 11 12 13
  • 13 12 11

Questão 38

Questão
what is the output of following program? void main(){ printf("One"); if(2>1) printf("Two"); else printf("Three"); printf("Four"); }
Responda
  • One Two Three
  • Two Three Four
  • One Two Four
  • One Three Four

Questão 39

Questão
what is the output of following program? void main(){ float a; a=6.7; if(a==6.7) printf("A"); else printf("B"); }
Responda
  • A
  • B
  • error
  • nothing display on screen

Questão 40

Questão
what is the output of following program? void main(){ int a; a=10; a*=10+2; printf("%d",a); }
Responda
  • 102
  • 100
  • 120
  • 22

Questão 41

Questão
what is the output of following program? void main(){ int a; a=100; printf("%d%d",++a,a++); }
Responda
  • 101 101
  • 101 102
  • 102 100
  • 102 101

Questão 42

Questão
What is the output of the following program? void main(){ int a; a=100>90>80; printf("%d",a); }
Responda
  • 0
  • 1
  • error
  • none of these

Questão 43

Questão
What will be the output of the following program void main( ){ int a=10; printf("%d",a); { int a=20; printf("%d",a); } printf("%d",a); }
Responda
  • 10 10
  • 20 10
  • 10 20 10
  • 10 10 10

Questão 44

Questão
What is the output of following program? void f1(){ int a=0; ++a; printf("%d",a); } main(){ int a=10; f1(); f1(); f1(); printf("%d",a); return 0; }
Responda
  • 0 1 1 10
  • 10 0 1 10
  • 1 2 3 4
  • 1 1 1 10

Semelhante

Economics definitions: F582
busybee112
Features of a Volcano
Deirdre Molloy
Human Biology Year 1 Semester 1 Midterm 1 - Cells
michellelynnlebl
Human Biology Year 1 Midterm 1 Genetics (plus all TOPHAT)
michellelynnlebl
public administration 1st year uni
Hanin Lewa
PR Skillset Key Messages
charlotte.cranny
Spot the FIB, Living in a medieval manor town.
Liz Broderick
Learning and Motivation MCQ
Ani Av
Thermoregulation
Mollie Bedford
Chapter 1 Quiz
UNSW O-Week
Renal System (Part of)
Addeana