Programming in C

Descripción

First year First Year Test sobre Programming in C, creado por Faheem Ahmed el 26/03/2018.
Faheem Ahmed
Test por Faheem Ahmed, actualizado hace más de 1 año
Faheem Ahmed
Creado por Faheem Ahmed hace alrededor de 6 años
1675
0

Resumen del Recurso

Pregunta 1

Pregunta
A C variable name can start with a ____
Respuesta
  • Number
  • Plus Sign (+)
  • Underscore
  • Asterisk (*)

Pregunta 2

Pregunta
Name the loop that executes at least once.
Respuesta
  • for
  • if
  • do-while
  • while

Pregunta 3

Pregunta
A pointer pointing to a memory location of the variable even after deletion of the variable is known as _____
Respuesta
  • far pointer
  • dangling pointer
  • null pointer
  • void pointer

Pregunta 4

Pregunta
Which of the following correctly shows the hierarchy of arithmetic operations in C?
Respuesta
  • / + * -
  • * - / +
  • + - / *
  • / * + -

Pregunta 5

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

Pregunta 6

Pregunta
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"); } }
Respuesta
  • B
  • b
  • bca
  • bc

Pregunta 7

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

Pregunta 8

Pregunta
Which among the following is NOT a logical or relational operator?
Respuesta
  • !=
  • ==
  • ||
  • =

Pregunta 9

Pregunta
Which of the following is not a correct variable type?
Respuesta
  • float
  • real
  • int
  • double

Pregunta 10

Pregunta
Which of the following is true?
Respuesta
  • 1
  • 66
  • 0.1
  • -1
  • All of the above

Pregunta 11

Pregunta
Evaluate !(1 && !(0 || 1)).
Respuesta
  • True
  • False
  • Unevaluatable
  • Error

Pregunta 12

Pregunta
Which of the following is the proper declaration of a pointer?
Respuesta
  • int x;
  • int &x;
  • ptr x;
  • int *x;

Pregunta 13

Pregunta
Which of the following gives the memory address of integer variable a?
Respuesta
  • *a;
  • a;
  • &a;
  • address(a);

Pregunta 14

Pregunta
Which of the following gives the value stored at the address pointed to by pointer a?
Respuesta
  • a;
  • val(a);
  • *a;
  • &a;

Pregunta 15

Pregunta
Which conversion is not possible?
Respuesta
  • int to float
  • float to int
  • char to float
  • All are possible

Pregunta 16

Pregunta
What variables stores the number of arguments to a program in command line arguments?
Respuesta
  • argc
  • argv
  • count
  • arglen

Pregunta 17

Pregunta
What is argv[0]?
Respuesta
  • The number of arguments to the program
  • The name of the program
  • The first argument to the program
  • This syntax is illegal

Pregunta 18

Pregunta
The parameter passing mechanism for an array is
Respuesta
  • call by value
  • call by value-result
  • call by reference
  • none of these

Pregunta 19

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

Pregunta 20

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

Pregunta 21

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

Pregunta 22

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

Pregunta 23

Pregunta
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?
Respuesta
  • x=1+x;
  • x=1—x;
  • x=x—1;
  • x=1%x;

Pregunta 24

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

Pregunta 25

Pregunta
Which of the following is not a storage class in C?
Respuesta
  • auto
  • struct
  • extern
  • static
  • register

Pregunta 26

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

Pregunta 27

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

Pregunta 28

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

Pregunta 29

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

Pregunta 30

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

Pregunta 31

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

Pregunta 32

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

Pregunta 33

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

Pregunta 34

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

Pregunta 35

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

Pregunta 36

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

Pregunta 37

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

Pregunta 38

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

Pregunta 39

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

Pregunta 40

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

Pregunta 41

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

Pregunta 42

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

Pregunta 43

Pregunta
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); }
Respuesta
  • 10 10
  • 20 10
  • 10 20 10
  • 10 10 10

Pregunta 44

Pregunta
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; }
Respuesta
  • 0 1 1 10
  • 10 0 1 10
  • 1 2 3 4
  • 1 1 1 10
Mostrar resumen completo Ocultar resumen completo

Similar

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